From 618ff5689670716bbadaa9e8f6827a1126426389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuncay=20=C3=87OLAK?= Date: Thu, 8 Oct 2020 12:09:57 +0300 Subject: [PATCH] Syncing /usr/share/ahenk to src and recreating ahenk.install --- .../base/messaging/anonymous_messenger.py | 30 ++++++++++++------- usr/share/ahenk/base/messaging/messenger.py | 4 +-- .../plugins/remote-access/setup-vnc-server.py | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/usr/share/ahenk/base/messaging/anonymous_messenger.py b/usr/share/ahenk/base/messaging/anonymous_messenger.py index b97c62f..729f24e 100644 --- a/usr/share/ahenk/base/messaging/anonymous_messenger.py +++ b/usr/share/ahenk/base/messaging/anonymous_messenger.py @@ -104,47 +104,55 @@ class AnonymousMessenger(ClientXMPP): self.logger.debug('Registration status: ' + str(status)) if 'not_authorized' == str(status): - self.logger.info('Registration is failed. User not authorized') + self.logger.debug('[REGISTRATION IS FAILED]. User not authorized') if self.registration.showUserNotify == True: - Util.show_message(os.getlogin(), ':0','Ahenk Lider MYS sistemine alınamadı !! Sadece yetkili kullanıcılar kayıt yapabilir.', 'Kullanıcı Yetkilendirme Hatası') + Util.show_message(os.getlogin(), ':0','Ahenk Lider MYS\`ye alınamadı !! Sadece yetkili kullanıcılar kayıt yapabilir.', 'Kullanıcı Yetkilendirme Hatası') self.logger.debug('Disconnecting...') self.disconnect() - elif 'already_exists' == str(status) or 'registered' == str(status) or 'registered_without_ldap' == str(status): + elif 'registered' == str(status) or 'registered_without_ldap' == str(status): try: self.logger.info('Registred from server. Registration process starting.') self.event_manager.fireEvent('REGISTRATION_SUCCESS', j) if self.registration.showUserNotify == True: msg = str(self.host) + " Etki Alanına hoş geldiniz." - Util.show_message(os.getlogin(), ':0' ,msg, "UYARI") + Util.show_message(os.getlogin(), ':0', msg, "UYARI") msg = "Değişikliklerin etkili olması için sistem yeniden başlayacaktır. Sistem yeniden başlatılıyor...." - Util.show_message(os.getlogin(), ':0',msg, "UYARI") + Util.show_message(os.getlogin(), ':0', msg, "UYARI") time.sleep(3) self.logger.info('Disconnecting...') self.disconnect() self.logger.info('Rebooting...') #System.Process.kill_by_pid(int(System.Ahenk.get_pid_number())) #sys.exit(2) - Util.shutdown(); + Util.shutdown() + except Exception as e: self.logger.error('Error Message: {0}.'.format(str(e))) if self.registration.showUserNotify == True: Util.show_message(os.getlogin(), ':0',str(e)) self.logger.debug('Disconnecting...') self.disconnect() + elif 'already_exists' == str(status): + self.logger.debug('[REGISTRATION IS FAILED] - Hostname already in use!') + if self.registration.showUserNotify == True: + Util.show_message(os.getlogin(), ':0', + '{0} bilgisayar adı zaten kullanılmaktadır. Lütfen bilgisayar adını değiştirerek tekrar deneyiniz'.format(System.Os.hostname()), + 'Bilgisayar İsimlendirme Hatası') + self.logger.debug('Disconnecting...') + self.disconnect() + elif 'registration_error' == str(status): - self.logger.info('Registration is failed. New registration request will send') + self.logger.info('[REGISTRATION IS FAILED] - New registration request will send') #self.event_manager.fireEvent('REGISTRATION_ERROR', str(j)) if self.registration.showUserNotify == True: - Util.show_message(os.getlogin(), ':0','Ahenk Lider MYS sistemine alınamadı !! Kayıt esnasında hata oluştu. Lütfen sistem yöneticinize başvurunuz.', + Util.show_message(os.getlogin(), ':0', 'Ahenk Lider MYS\`ye alınamadı !! Kayıt esnasında hata oluştu. Lütfen sistem yöneticinize başvurunuz.', 'Sistem Hatası') self.logger.debug('Disconnecting...') self.disconnect() else: - self.event_manger.fireEvent(message_type, str(msg['body'])) + self.event_manager.fireEvent(message_type, str(msg['body'])) self.logger.debug('Fired event is: {0}'.format(message_type)) def send_direct_message(self, msg): self.logger.debug('<<--------Sending message: {0}'.format(msg)) self.send_message(mto=self.receiver, mbody=msg, mtype='normal') - - diff --git a/usr/share/ahenk/base/messaging/messenger.py b/usr/share/ahenk/base/messaging/messenger.py index f3a3bf7..be49d52 100644 --- a/usr/share/ahenk/base/messaging/messenger.py +++ b/usr/share/ahenk/base/messaging/messenger.py @@ -46,6 +46,7 @@ class Messenger(ClientXMPP): if self.receiver_resource: self.receiver += '/' + self.receiver_resource + self.port = self.configuration_manager.get('CONNECTION', 'port') self.logger.debug('XMPP Messager parameters were set') self.register_extensions() @@ -73,8 +74,7 @@ class Messenger(ClientXMPP): def connect_to_server(self): # Connect to the XMPP server and start processing XMPP stanzas. try: self['feature_mechanisms'].unencrypted_plain = True - - self.connect((self.hostname, 5222), use_tls=self.use_tls) + self.connect((self.hostname, self.port), use_tls=self.use_tls) self.process(block=False) self.logger.debug('Connection were established successfully') return True diff --git a/usr/share/ahenk/plugins/remote-access/setup-vnc-server.py b/usr/share/ahenk/plugins/remote-access/setup-vnc-server.py index db43d0b..efd066f 100644 --- a/usr/share/ahenk/plugins/remote-access/setup-vnc-server.py +++ b/usr/share/ahenk/plugins/remote-access/setup-vnc-server.py @@ -66,7 +66,7 @@ class SetupVnc(AbstractPlugin): display_number = self.Sessions.display(user_name) desktop_env = self.get_desktop_env() if desktop_env == "gnome": - self.get_username_display_gnome(user_name) + display_number = self.get_username_display_gnome(user_name) self.logger.info("Get display of {0} is {1}".format(user_name, display_number)) homedir = self.get_homedir(user_name) self.logger.info("Get home directory of {0} is {1}".format(user_name, homedir))