Skip to content
Snippets Groups Projects
Commit 8b95c66a authored by André's avatar André
Browse files

MUC: Replace /me in notification

parent d2fe296d
No related branches found
No related tags found
No related merge requests found
...@@ -325,7 +325,9 @@ def handle_incoming_gc_msg_event(self, msg_obj): ...@@ -325,7 +325,9 @@ def handle_incoming_gc_msg_event(self, msg_obj):
sound = msg_obj.gc_control.highlighting_for_message( sound = msg_obj.gc_control.highlighting_for_message(
msg_obj.msgtxt, msg_obj.properties.timestamp)[1] msg_obj.msgtxt, msg_obj.properties.timestamp)[1]
if msg_obj.properties.muc_nickname != msg_obj.gc_control.nick: nick = msg_obj.properties.muc_nickname
if nick != msg_obj.gc_control.nick:
self.do_sound = True self.do_sound = True
if sound == 'received': if sound == 'received':
self.sound_event = 'muc_message_received' self.sound_event = 'muc_message_received'
...@@ -364,6 +366,9 @@ def handle_incoming_gc_msg_event(self, msg_obj): ...@@ -364,6 +366,9 @@ def handle_incoming_gc_msg_event(self, msg_obj):
if app.config.get('notification_preview_message'): if app.config.get('notification_preview_message'):
self.popup_text = msg_obj.msgtxt self.popup_text = msg_obj.msgtxt
if self.popup_text and (self.popup_text.startswith('/me ') or
self.popup_text.startswith('/me\n')):
self.popup_text = '* ' + nick + self.popup_text[3:]
type_events = ['printed_marked_gc_msg', 'printed_gc_msg'] type_events = ['printed_marked_gc_msg', 'printed_gc_msg']
count = len(app.events.get_events(self.account, self.jid, type_events)) count = len(app.events.get_events(self.account, self.jid, type_events))
...@@ -373,7 +378,7 @@ def handle_incoming_gc_msg_event(self, msg_obj): ...@@ -373,7 +378,7 @@ def handle_incoming_gc_msg_event(self, msg_obj):
self.popup_title = i18n.ngettext( self.popup_title = i18n.ngettext(
'New message from %(nickname)s', 'New message from %(nickname)s',
'%(n_msgs)i unread messages in %(groupchat_name)s', '%(n_msgs)i unread messages in %(groupchat_name)s',
count) % {'nickname': msg_obj.properties.muc_nickname, count) % {'nickname': nick,
'n_msgs': count, 'n_msgs': count,
'groupchat_name': contact.get_shown_name()} 'groupchat_name': contact.get_shown_name()}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment