diff src/browser/libervia_main.py @ 533:19fc2ebc02dd

browser_side: management of new "info" newMessage type
author Goffi <goffi@goffi.org>
date Fri, 05 Sep 2014 19:29:35 +0200
parents 1735aaeac652
children 048ae7314156
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Fri Sep 05 12:26:33 2014 +0200
+++ b/src/browser/libervia_main.py	Fri Sep 05 19:29:35 2014 +0200
@@ -717,13 +717,12 @@
         self.newMessageCb(from_jid, msg, msg_type, to_jid, extra)
 
     def newMessageCb(self, from_jid, msg, msg_type, to_jid, extra):
-        # FIXME: newMessage should manage system message, so they don't appear as coming from the contact
         other = to_jid if from_jid.bare == self.whoami.bare else from_jid
         lib_wid = self.getLiberviaWidget(panels.ChatPanel, other, ignoreOtherTabs=False)
         self.displayNotification(from_jid, msg)
         if msg_type == 'headline' and from_jid.full() == self._defaultDomain:
             try:
-                assert(extra['subject'])  # subject is defined and not empty
+                assert extra['subject']  # subject is defined and not empty
                 title = extra['subject']
             except (KeyError, AssertionError):
                 title = _('Announcement from %s') % from_jid.full()
@@ -731,8 +730,12 @@
             dialog.InfoDialog(title, msg).show()
             return
         if lib_wid is not None:
-            lib_wid.printMessage(from_jid, msg, extra)
+            if msg_type == C.MESS_TYPE_INFO:
+                lib_wid.printInfo(msg)
+            else:
+                lib_wid.printMessage(from_jid, msg, extra)
         else:
+            # FIXME: "info" message will be lost here
             if not self.contact_panel.isContactInRoster(other.bare):
                 self.contact_panel.updateContact(other.bare, {}, [C.GROUP_NOT_IN_ROSTER])
             # The message has not been shown, we must indicate it