changeset 645:122b4483dac4 frontends_multi_profiles

browser side: restored infoDialog for headline messages from server
author Goffi <goffi@goffi.org>
date Wed, 25 Feb 2015 19:40:23 +0100
parents 7692bbfe0b2f
children 9972a24592b0
files src/browser/libervia_main.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Tue Feb 24 20:27:31 2015 +0100
+++ b/src/browser/libervia_main.py	Wed Feb 25 19:40:23 2015 +0100
@@ -367,6 +367,20 @@
         log.debug("newWidget: {}".format(widget))
         self.addWidget(widget)
 
+    def newMessageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile):
+        if type_ == C.MESS_TYPE_HEADLINE:
+            from_jid = jid.JID(from_jid_s)
+            if from_jid.domain == self._defaultDomain:
+                # we display announcement from the server in a dialog for better visibility
+                try:
+                    title = extra['subject']
+                except KeyError:
+                    title = _('Announcement from %s') % from_jid
+                msg = strings.addURLToText(html_tools.XHTML2Text(msg))
+                dialog.InfoDialog(title, msg).show()
+                return
+        QuickApp.newMesageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile)
+
     def disconnectedHandler(self, profile):
         QuickApp.disconnectedHandler(self, profile)
         Window.getLocation().reload()