diff --git a/data/gui/gc_control_popup_menu.ui b/data/gui/gc_control_popup_menu.ui index 35bc6e2b3..719bcd34a 100644 --- a/data/gui/gc_control_popup_menu.ui +++ b/data/gui/gc_control_popup_menu.ui @@ -1,5 +1,5 @@ - + @@ -65,6 +65,13 @@ True + + + True + False + Notify on all messages + + False diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py index a5e05a16a..376286950 100644 --- a/gajim/chat_control_base.py +++ b/gajim/chat_control_base.py @@ -957,6 +957,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): if kind == 'incoming': if not self.type_id == message_control.TYPE_GC or \ app.config.get('notify_on_all_muc_messages') or \ + app.config.get_per('rooms', jid, 'notify_on_all_messages') or \ 'marked' in other_tags_for_text: # it's a normal message, or a muc message with want to be # notified about if quitting just after @@ -1141,6 +1142,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): app.config.set_per('accounts', self.account, 'non_minimized_gc', ' '.join(non_minimized_gc)) + def on_notify_menuitem_toggled(self, widget): + app.config.set_per('rooms', self.contact.jid, 'notify_on_all_messages', + widget.get_active()) + def set_control_active(self, state): if state: self.set_emoticon_popover() diff --git a/gajim/common/config.py b/gajim/common/config.py index 48047bc7c..6fbf8570d 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -492,6 +492,7 @@ class Config: 'speller_language': [ opt_str, '', _('Language for which we want to check misspelled words')], 'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')], 'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog to request when entering a groupchat. -1 means no limit, -2 means global value')], + 'notify_on_all_messages': [opt_bool, False, _('State whether we want a notification for every message in this room')], }, {}), 'plugins': ({ 'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')], diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py index 9c1dffd9d..7d6a509b7 100644 --- a/gajim/groupchat_control.py +++ b/gajim/groupchat_control.py @@ -905,6 +905,7 @@ class GroupchatControl(ChatControlBase): history_menuitem = xml.get_object('history_menuitem') disconnect_menuitem = xml.get_object('disconnect_menuitem') minimize_menuitem = xml.get_object('minimize_menuitem') + notify_menuitem = xml.get_object('notify_menuitem') request_voice_menuitem = xml.get_object('request_voice_menuitem') bookmark_separator = xml.get_object('bookmark_separator') separatormenuitem2 = xml.get_object('separatormenuitem2') @@ -943,6 +944,8 @@ class GroupchatControl(ChatControlBase): if self.contact.jid not in app.config.get_per('accounts', self.account, 'non_minimized_gc').split(' '): minimize_menuitem.set_active(True) + notify_menuitem.set_active(app.config.get_per('rooms', self.contact.jid, + 'notify_on_all_messages')) conn = app.connections[self.account] if not conn.private_storage_supported and (not conn.pubsub_supported or \ not conn.pubsub_publish_options_supported): @@ -1009,6 +1012,10 @@ class GroupchatControl(ChatControlBase): self.on_minimize_menuitem_toggled) self.handlers[id_] = minimize_menuitem + id_ = notify_menuitem.connect('toggled', + self.on_notify_menuitem_toggled) + self.handlers[id_] = notify_menuitem + menu.connect('selection-done', self.destroy_menu, change_nick_menuitem, change_subject_menuitem, bookmark_room_menuitem, history_menuitem) @@ -1245,7 +1252,8 @@ class GroupchatControl(ChatControlBase): def get_nb_unread(self): type_events = ['printed_marked_gc_msg'] - if app.config.get('notify_on_all_muc_messages'): + if app.config.get('notify_on_all_muc_messages') or \ + app.config.get_per('rooms', self.room_jid, 'notify_on_all_messages'): type_events.append('printed_gc_msg') nb = len(app.events.get_events(self.account, self.room_jid, type_events)) diff --git a/gajim/message_window.py b/gajim/message_window.py index ee508b752..9fdc7ae79 100644 --- a/gajim/message_window.py +++ b/gajim/message_window.py @@ -501,7 +501,8 @@ class MessageWindow(object): for ctrl in self.controls(): if ctrl.type_id == message_control.TYPE_GC and not \ app.config.get('notify_on_all_muc_messages') and not \ - ctrl.attention_flag: + app.config.get_per('rooms', ctrl.room_jid, + 'notify_on_all_messages') and not ctrl.attention_flag: # count only pm messages unread += ctrl.get_nb_unread_pm() continue @@ -518,7 +519,9 @@ class MessageWindow(object): if control.type_id == message_control.TYPE_GC: name = control.room_jid.split('@')[0] urgent = control.attention_flag or \ - app.config.get('notify_on_all_muc_messages') + app.config.get('notify_on_all_muc_messages') or \ + app.config.get_per('rooms', control.room_jid, + 'notify_on_all_messages') else: name = control.contact.get_shown_name() if control.resource: diff --git a/gajim/notify.py b/gajim/notify.py index d2a80f08e..6322e2898 100644 --- a/gajim/notify.py +++ b/gajim/notify.py @@ -68,7 +68,8 @@ def get_show_in_systray(event, account, contact, type_=None): Return True if this event must be shown in systray, else False """ if type_ == 'printed_gc_msg' and not app.config.get( - 'notify_on_all_muc_messages'): + 'notify_on_all_muc_messages') and not app.config.get_per('rooms', + contact.jid, 'notify_on_all_messages'): # it's not an highlighted message, don't show in systray return False return app.config.get('trayicon_notification_on_events')