# HG changeset patch # User Goffi # Date 1562570406 -7200 # Node ID 4d5b9d4c74483dcb0a5f3b41455fc16812b8300a # Parent f4590ca2acffc23b70ce985b2ad7e019238ac89b primitivus (chat): don't show minor notifications (all but mentions) when printing history fix 316 diff -r f4590ca2acff -r 4d5b9d4c7448 sat_frontends/primitivus/chat.py --- a/sat_frontends/primitivus/chat.py Sun Jul 07 15:39:53 2019 +0200 +++ b/sat_frontends/primitivus/chat.py Mon Jul 08 09:20:06 2019 +0200 @@ -426,11 +426,16 @@ self.mess_widgets.focus_position = bottom # scroll down self.host.redraw() # FIXME: should not be necessary - def appendMessage(self, message): + def appendMessage(self, message, minor_notifs=True): """Create a MessageWidget and append it - Can merge messages together is desirable (e.g.: multiple joined/leave) + Can merge info messages together if desirable (e.g.: multiple joined/leave) @param message(quick_chat.Message): message to add + @param minor_notifs(boolean): if True, basic notifications are allowed + If False, notification are not shown except if we have an important one + (like a mention). + False is generally used when printing history, when we don't want every + message to be notified. """ if self.filters: if not all([f(message) for f in self.filters]): @@ -481,6 +486,8 @@ self.host.notify( C.NOTIFY_MENTION, from_jid, msg, widget=self, profile=self.profile ) + elif not minor_notifs: + return elif self.type == C.CHAT_ONE2ONE: from_jid = wid.mess_data.from_jid msg = _(u"{entity} is talking to you".format(entity=from_jid)) @@ -567,7 +574,7 @@ if clear: del self.mess_walker[:] for message in self.messages.itervalues(): - self.appendMessage(message) + self.appendMessage(message, minor_notifs=False) def redraw(self): """redraw all messages"""