From 735c88d5bf0d7d2a07df7d6236b0d27cc67c27af Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Fri, 15 Jul 2016 03:10:41 -0700 Subject: [PATCH] notifications fix, reconnect added --- toxygen/callbacks.py | 6 +++--- toxygen/menu.py | 1 + toxygen/profile.py | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toxygen/callbacks.py b/toxygen/callbacks.py index 72eeb66..450df1e 100644 --- a/toxygen/callbacks.py +++ b/toxygen/callbacks.py @@ -293,7 +293,7 @@ def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, aud def group_message(window, tray, tox): """ - New message from friend + New message in group chat """ def wrapped(tox_link, group_number, peer_id, message_type, message, length, user_data): profile = Profile.get_instance() @@ -303,9 +303,9 @@ def group_message(window, tray, tox): if not window.isActiveWindow(): bl = settings['notify_all_gc'] or profile.name in message name = tox.group_peer_get_name(group_number, peer_id) - if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY'] and not settings.locked and bl: + if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY'] and (not settings.locked) and bl: invoke_in_main_thread(tray_notification, name, message, tray, window) - if (settings['sound_notifications'] or bl) and profile.status != TOX_USER_STATUS['BUSY']: + if settings['sound_notifications'] and bl and profile.status != TOX_USER_STATUS['BUSY']: sound_notification(SOUND_NOTIFICATION['MESSAGE']) invoke_in_main_thread(tray.setIcon, QtGui.QIcon(curr_directory() + '/images/icon_new_messages.png')) return wrapped diff --git a/toxygen/menu.py b/toxygen/menu.py index 725ee60..8dc9621 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -638,6 +638,7 @@ class NotificationsSettings(CenteredWidget): settings['notifications'] = self.enableNotifications.isChecked() settings['sound_notifications'] = self.soundNotifications.isChecked() settings['calls_sound'] = self.callsSound.isChecked() + settings['notify_all_gc'] = self.gcNotifications.isChecked() settings.save() diff --git a/toxygen/profile.py b/toxygen/profile.py index f1ed62b..edd4255 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -96,6 +96,9 @@ class Profile(basecontact.BaseContact, Singleton): self.set_status((self._status + 1) % 3) def set_status(self, status): + if self.status is None: + for gc in filter(lambda x: type(x) is GroupChat, self._friends_and_gc): + self._tox.group_reconnect(gc.number) super(Profile, self).set_status(status) if status is not None: self._tox.self_set_status(status)