Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
623:4f7550a083b4 | 624:9092e624bb27 |
---|---|
45 import radiocol | 45 import radiocol |
46 import base_widget | 46 import base_widget |
47 import contact_list | 47 import contact_list |
48 from constants import Const as C | 48 from constants import Const as C |
49 import plugin_xep_0085 | 49 import plugin_xep_0085 |
50 | |
51 | |
52 unicode = str # FIXME: pyjamas workaround | |
50 | 53 |
51 | 54 |
52 class ChatText(HTMLPanel): | 55 class ChatText(HTMLPanel): |
53 | 56 |
54 def __init__(self, nick, mymess, msg, extra): | 57 def __init__(self, nick, mymess, msg, extra): |
86 # FIXME: temporary dirty initialization to display the OTR state | 89 # FIXME: temporary dirty initialization to display the OTR state |
87 def header_info_cb(cb): | 90 def header_info_cb(cb): |
88 host.plugins['otr'].infoTextCallback(target, cb) | 91 host.plugins['otr'].infoTextCallback(target, cb) |
89 header_info = header_info_cb if (type_ == C.CHAT_ONE2ONE and 'otr' in host.plugins) else None | 92 header_info = header_info_cb if (type_ == C.CHAT_ONE2ONE and 'otr' in host.plugins) else None |
90 | 93 |
91 base_widget.LiberviaWidget.__init__(self, host, title=target.bare, info=header_info, selectable=True) | 94 base_widget.LiberviaWidget.__init__(self, host, title=unicode(target.bare), info=header_info, selectable=True) |
92 self._body = AbsolutePanel() | 95 self._body = AbsolutePanel() |
93 self._body.setStyleName('chatPanel_body') | 96 self._body.setStyleName('chatPanel_body') |
94 chat_area = HorizontalPanel() | 97 chat_area = HorizontalPanel() |
95 chat_area.setStyleName('chatArea') | 98 chat_area.setStyleName('chatArea') |
96 if type_ == C.CHAT_GROUP: | 99 if type_ == C.CHAT_GROUP: |
204 self.state_machine._onEvent("active") | 207 self.state_machine._onEvent("active") |
205 | 208 |
206 def onQuit(self): | 209 def onQuit(self): |
207 base_widget.LiberviaWidget.onQuit(self) | 210 base_widget.LiberviaWidget.onQuit(self) |
208 if self.type == C.CHAT_GROUP: | 211 if self.type == C.CHAT_GROUP: |
209 self.host.bridge.call('mucLeave', None, self.target.bare) | 212 self.host.bridge.call('mucLeave', None, unicode(self.target.bare)) |
210 | 213 |
211 def setUserNick(self, nick): | 214 def setUserNick(self, nick): |
212 """Set the nick of the user, usefull for e.g. change the color of the user""" | 215 """Set the nick of the user, usefull for e.g. change the color of the user""" |
213 self.nick = nick | 216 self.nick = nick |
214 | 217 |
336 self.refreshTitle() | 339 self.refreshTitle() |
337 self.state_machine.started = not not state # start to send "composing" state from now | 340 self.state_machine.started = not not state # start to send "composing" state from now |
338 | 341 |
339 def refreshTitle(self): | 342 def refreshTitle(self): |
340 """Refresh the title of this Chat dialog""" | 343 """Refresh the title of this Chat dialog""" |
344 title = unicode(self.target.bare) | |
341 if self._state: | 345 if self._state: |
342 self.setTitle(self.target.bare + " (" + self._state + ")") | 346 title += " (%s)".format(self._state) |
343 else: | 347 self.setTitle(title) |
344 self.setTitle(self.target.bare) | |
345 | 348 |
346 def setConnected(self, jid_s, resource, availability, priority, statuses): | 349 def setConnected(self, jid_s, resource, availability, priority, statuses): |
347 """Set connection status | 350 """Set connection status |
348 @param jid_s (str): JID userhost as unicode | 351 @param jid_s (str): JID userhost as unicode |
349 """ | 352 """ |