quick_frontend, primitivus (chat): move notification command to quick_frontend
This commit is contained in:
parent
cab9a9645e
commit
a08a073503
2 changed files with 17 additions and 9 deletions
|
|
@ -303,13 +303,9 @@ class Chat(PrimitivusWidget, QuickChat):
|
|||
@param message (unicode): message content
|
||||
@param extra (dict): extra data
|
||||
"""
|
||||
QuickChat.printMessage(self, nick, my_message, message, timestamp, extra, profile)
|
||||
new_text = ChatText(self, timestamp, nick, my_message, message)
|
||||
self.content.append(new_text)
|
||||
if not timestamp:
|
||||
# XXX: do not send notifications for each line of the history being displayed
|
||||
# FIXME: this must be changed in the future if the timestamp is passed with
|
||||
# all messages and not only with the messages coming from the history.
|
||||
self._notify(nick, message)
|
||||
|
||||
def printInfo(self, msg, type_='normal', extra=None):
|
||||
"""Print general info
|
||||
|
|
@ -319,6 +315,7 @@ class Chat(PrimitivusWidget, QuickChat):
|
|||
me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
|
||||
@param timestamp (float): number of seconds since epoch
|
||||
"""
|
||||
QuickChat.printInfo(self, msg, type_, extra)
|
||||
if extra is None:
|
||||
extra = {}
|
||||
try:
|
||||
|
|
@ -327,9 +324,8 @@ class Chat(PrimitivusWidget, QuickChat):
|
|||
timestamp = None
|
||||
_widget = ChatText(self, timestamp, None, False, msg, is_info=True)
|
||||
self.content.append(_widget)
|
||||
self._notify(msg=msg)
|
||||
|
||||
def _notify(self, contact="somebody", msg=""):
|
||||
def notify(self, contact="somebody", msg=""):
|
||||
"""Notify the user of a new message if primitivus doesn't have the focus.
|
||||
|
||||
@param contact (unicode): contact who wrote to the users
|
||||
|
|
|
|||
|
|
@ -232,7 +232,11 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
@param message (unicode): message content
|
||||
@param extra (dict): extra data
|
||||
"""
|
||||
raise NotImplementedError
|
||||
if not timestamp:
|
||||
# XXX: do not send notifications for each line of the history being displayed
|
||||
# FIXME: this must be changed in the future if the timestamp is passed with
|
||||
# all messages and not only with the messages coming from the history.
|
||||
self.notify(nick, message)
|
||||
|
||||
def printInfo(self, msg, type_='normal', extra=None):
|
||||
"""Print general info.
|
||||
|
|
@ -243,7 +247,15 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
- 'me': "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
|
||||
@param extra (dict): message data
|
||||
"""
|
||||
raise NotImplementedError
|
||||
self.notify(msg=msg)
|
||||
|
||||
def notify(self, contact="somebody", msg=""):
|
||||
"""Notify the user of a new message if the frontend doesn't have the focus.
|
||||
|
||||
@param contact (unicode): contact who wrote to the users
|
||||
@param msg (unicode): the message that has been received
|
||||
"""
|
||||
raise NotImplemented
|
||||
|
||||
def printDayChange(self, day):
|
||||
"""Display the day on a new line.
|
||||
|
|
|
|||
Loading…
Reference in a new issue