notifications fix, reconnect added
This commit is contained in:
parent
2745caa531
commit
735c88d5bf
3 changed files with 7 additions and 3 deletions
|
@ -293,7 +293,7 @@ def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, aud
|
||||||
|
|
||||||
def group_message(window, tray, tox):
|
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):
|
def wrapped(tox_link, group_number, peer_id, message_type, message, length, user_data):
|
||||||
profile = Profile.get_instance()
|
profile = Profile.get_instance()
|
||||||
|
@ -303,9 +303,9 @@ def group_message(window, tray, tox):
|
||||||
if not window.isActiveWindow():
|
if not window.isActiveWindow():
|
||||||
bl = settings['notify_all_gc'] or profile.name in message
|
bl = settings['notify_all_gc'] or profile.name in message
|
||||||
name = tox.group_peer_get_name(group_number, peer_id)
|
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)
|
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'])
|
sound_notification(SOUND_NOTIFICATION['MESSAGE'])
|
||||||
invoke_in_main_thread(tray.setIcon, QtGui.QIcon(curr_directory() + '/images/icon_new_messages.png'))
|
invoke_in_main_thread(tray.setIcon, QtGui.QIcon(curr_directory() + '/images/icon_new_messages.png'))
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
|
@ -638,6 +638,7 @@ class NotificationsSettings(CenteredWidget):
|
||||||
settings['notifications'] = self.enableNotifications.isChecked()
|
settings['notifications'] = self.enableNotifications.isChecked()
|
||||||
settings['sound_notifications'] = self.soundNotifications.isChecked()
|
settings['sound_notifications'] = self.soundNotifications.isChecked()
|
||||||
settings['calls_sound'] = self.callsSound.isChecked()
|
settings['calls_sound'] = self.callsSound.isChecked()
|
||||||
|
settings['notify_all_gc'] = self.gcNotifications.isChecked()
|
||||||
settings.save()
|
settings.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,9 @@ class Profile(basecontact.BaseContact, Singleton):
|
||||||
self.set_status((self._status + 1) % 3)
|
self.set_status((self._status + 1) % 3)
|
||||||
|
|
||||||
def set_status(self, status):
|
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)
|
super(Profile, self).set_status(status)
|
||||||
if status is not None:
|
if status is not None:
|
||||||
self._tox.self_set_status(status)
|
self._tox.self_set_status(status)
|
||||||
|
|
Loading…
Reference in a new issue