Mercurial > libervia-web
comparison src/browser/sat_browser/chat.py @ 663:423182fea41c frontends_multi_profiles
browser_side: fixes OTR using the new resource system and proper triggers (send and receive message) or listener (presence update)
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 03 Mar 2015 07:21:50 +0100 (2015-03-03) |
parents | ebb602d8b3f2 |
children | 2201ff543a05 |
comparison
equal
deleted
inserted
replaced
662:ebb602d8b3f2 | 663:423182fea41c |
---|---|
86 QuickChat.__init__(self, host, target, type_, profiles=profiles) | 86 QuickChat.__init__(self, host, target, type_, profiles=profiles) |
87 self.vpanel = VerticalPanel() | 87 self.vpanel = VerticalPanel() |
88 self.vpanel.setSize('100%', '100%') | 88 self.vpanel.setSize('100%', '100%') |
89 | 89 |
90 # FIXME: temporary dirty initialization to display the OTR state | 90 # FIXME: temporary dirty initialization to display the OTR state |
91 def header_info_cb(cb): | 91 header_info = host.plugins['otr'].getInfoTextForUser(target) if (type_ == C.CHAT_ONE2ONE and 'otr' in host.plugins) else None |
92 host.plugins['otr'].infoTextCallback(target, cb) | |
93 header_info = header_info_cb if (type_ == C.CHAT_ONE2ONE and 'otr' in host.plugins) else None | |
94 | 92 |
95 libervia_widget.LiberviaWidget.__init__(self, host, title=unicode(target.bare), info=header_info, selectable=True) | 93 libervia_widget.LiberviaWidget.__init__(self, host, title=unicode(target.bare), info=header_info, selectable=True) |
96 self._body = AbsolutePanel() | 94 self._body = AbsolutePanel() |
97 self._body.setStyleName('chatPanel_body') | 95 self._body.setStyleName('chatPanel_body') |
98 chat_area = HorizontalPanel() | 96 chat_area = HorizontalPanel() |
183 elif self.type == C.CHAT_GROUP: | 181 elif self.type == C.CHAT_GROUP: |
184 msg = "This message will be sent to all the participants of the multi-user room <span class='warningTarget'>%s</span>" % self.target | 182 msg = "This message will be sent to all the participants of the multi-user room <span class='warningTarget'>%s</span>" % self.target |
185 return ("ONE2ONE" if self.type == C.CHAT_ONE2ONE else "GROUP", msg) | 183 return ("ONE2ONE" if self.type == C.CHAT_ONE2ONE else "GROUP", msg) |
186 | 184 |
187 def onTextEntered(self, text): | 185 def onTextEntered(self, text): |
188 self.host.sendMessage(unicode(self.target), | 186 self.host.sendMessage(self.target, |
189 text, | 187 text, |
190 mess_type = C.MESS_TYPE_GROUPCHAT if self.type == C.CHAT_GROUP else C.MESS_TYPE_CHAT, | 188 mess_type=C.MESS_TYPE_GROUPCHAT if self.type == C.CHAT_GROUP else C.MESS_TYPE_CHAT, |
191 errback=self.host.sendError, | 189 errback=self.host.sendError, |
192 profile_key=C.PROF_KEY_NONE | 190 profile_key=C.PROF_KEY_NONE |
193 ) | 191 ) |
194 self.state_machine._onEvent("active") | 192 self.state_machine._onEvent("active") |
195 | 193 |
196 def onQuit(self): | 194 def onQuit(self): |
197 libervia_widget.LiberviaWidget.onQuit(self) | 195 libervia_widget.LiberviaWidget.onQuit(self) |
198 if self.type == C.CHAT_GROUP: | 196 if self.type == C.CHAT_GROUP: |