diff frontends/src/quick_frontend/quick_chat.py @ 1786:104874018ab0

quick_frontend, primitivus (chat): move notification command to quick_frontend
author souliane <souliane@mailoo.org>
date Tue, 12 Jan 2016 17:52:17 +0100
parents d17772b0fe22
children 2daf7b4c6756
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py	Fri Jan 08 18:54:23 2016 +0100
+++ b/frontends/src/quick_frontend/quick_chat.py	Tue Jan 12 17:52:17 2016 +0100
@@ -232,7 +232,11 @@
         @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 @@
             - '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.