primitivus (chat): don't show minor notifications (all but mentions) when printing history
fix 316
This commit is contained in:
parent
eb08ab4927
commit
48173b1961
1 changed files with 10 additions and 3 deletions
|
|
@ -426,11 +426,16 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat):
|
|||
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 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat):
|
|||
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 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat):
|
|||
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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue