Ability to be notified on all message. Option is now perroom. Fixes #8646
This commit is contained in:
parent
163306f78a
commit
07ba85b456
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkMenu" id="gc_control_popup_menu">
|
||||
|
@ -65,6 +65,13 @@
|
|||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="notify_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Notify on all messages</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="request_voice_separator">
|
||||
<property name="can_focus">False</property>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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.')],
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue