diff src/browser/sat_browser/chat.py @ 624:9092e624bb27 frontends_multi_profiles

browser_side: fixes various issues
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 21:51:20 +0100
parents 5baca9d46c34
children 6d3142b782c3
line wrap: on
line diff
--- a/src/browser/sat_browser/chat.py	Sun Feb 22 21:42:14 2015 +0100
+++ b/src/browser/sat_browser/chat.py	Sun Feb 22 21:51:20 2015 +0100
@@ -49,6 +49,9 @@
 import plugin_xep_0085
 
 
+unicode = str  # FIXME: pyjamas workaround
+
+
 class ChatText(HTMLPanel):
 
     def __init__(self, nick, mymess, msg, extra):
@@ -88,7 +91,7 @@
             host.plugins['otr'].infoTextCallback(target, cb)
         header_info = header_info_cb if (type_ == C.CHAT_ONE2ONE and 'otr' in host.plugins) else None
 
-        base_widget.LiberviaWidget.__init__(self, host, title=target.bare, info=header_info, selectable=True)
+        base_widget.LiberviaWidget.__init__(self, host, title=unicode(target.bare), info=header_info, selectable=True)
         self._body = AbsolutePanel()
         self._body.setStyleName('chatPanel_body')
         chat_area = HorizontalPanel()
@@ -206,7 +209,7 @@
     def onQuit(self):
         base_widget.LiberviaWidget.onQuit(self)
         if self.type == C.CHAT_GROUP:
-            self.host.bridge.call('mucLeave', None, self.target.bare)
+            self.host.bridge.call('mucLeave', None, unicode(self.target.bare))
 
     def setUserNick(self, nick):
         """Set the nick of the user, usefull for e.g. change the color of the user"""
@@ -338,10 +341,10 @@
 
     def refreshTitle(self):
         """Refresh the title of this Chat dialog"""
+        title = unicode(self.target.bare)
         if self._state:
-            self.setTitle(self.target.bare + " (" + self._state + ")")
-        else:
-            self.setTitle(self.target.bare)
+            title += " (%s)".format(self._state)
+        self.setTitle(title)
 
     def setConnected(self, jid_s, resource, availability, priority, statuses):
         """Set connection status