comparison src/browser/sat_browser/chat.py @ 662:ebb602d8b3f2 frontends_multi_profiles

browser_side: replace all instances of 'str' with 'unicode'
author souliane <souliane@mailoo.org>
date Tue, 03 Mar 2015 06:51:13 +0100
parents 267761bf7f08
children 423182fea41c
comparison
equal deleted inserted replaced
661:2664fe93ceb3 662:ebb602d8b3f2
109 chat_area.setCellWidth(self.content_scroll, '100%') 109 chat_area.setCellWidth(self.content_scroll, '100%')
110 self.vpanel.add(self._body) 110 self.vpanel.add(self._body)
111 self.vpanel.setCellHeight(self._body, '100%') 111 self.vpanel.setCellHeight(self._body, '100%')
112 self.addStyleName('chatPanel') 112 self.addStyleName('chatPanel')
113 self.setWidget(self.vpanel) 113 self.setWidget(self.vpanel)
114 self.state_machine = plugin_xep_0085.ChatStateMachine(self.host, str(self.target)) 114 self.state_machine = plugin_xep_0085.ChatStateMachine(self.host, unicode(self.target))
115 self._state = None 115 self._state = None
116 self.refresh() 116 self.refresh()
117 if type_ == C.CHAT_ONE2ONE: 117 if type_ == C.CHAT_ONE2ONE:
118 self.historyPrint(profile=self.profile) 118 self.historyPrint(profile=self.profile)
119 119
183 elif self.type == C.CHAT_GROUP: 183 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 184 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) 185 return ("ONE2ONE" if self.type == C.CHAT_ONE2ONE else "GROUP", msg)
186 186
187 def onTextEntered(self, text): 187 def onTextEntered(self, text):
188 self.host.sendMessage(str(self.target), 188 self.host.sendMessage(unicode(self.target),
189 text, 189 text,
190 mess_type = C.MESS_TYPE_GROUPCHAT if self.type == C.CHAT_GROUP else C.MESS_TYPE_CHAT, 190 mess_type = C.MESS_TYPE_GROUPCHAT if self.type == C.CHAT_GROUP else C.MESS_TYPE_CHAT,
191 errback=self.host.sendError, 191 errback=self.host.sendError,
192 profile_key=C.PROF_KEY_NONE 192 profile_key=C.PROF_KEY_NONE
193 ) 193 )
202 """Set the nick of the user, usefull for e.g. change the color of the user""" 202 """Set the nick of the user, usefull for e.g. change the color of the user"""
203 self.nick = nick 203 self.nick = nick
204 204
205 def setPresents(self, nicks): 205 def setPresents(self, nicks):
206 """Set the users presents in this room 206 """Set the users presents in this room
207 @param occupants: list of nicks (string)""" 207 @param occupants (list[unicode]): list of nicks
208 """
208 self.occupants_panel.setList([jid.JID(u"%s/%s" % (self.target,nick)) for nick in nicks]) 209 self.occupants_panel.setList([jid.JID(u"%s/%s" % (self.target,nick)) for nick in nicks])
209 210
210 # def userJoined(self, nick, data): 211 # def userJoined(self, nick, data):
211 # if self.occupants_panel.getOccupantBox(nick): 212 # if self.occupants_panel.getOccupantBox(nick):
212 # return # user is already displayed 213 # return # user is already displayed
333 title += " (%s)".format(self._state) 334 title += " (%s)".format(self._state)
334 self.setTitle(title) 335 self.setTitle(title)
335 336
336 def setConnected(self, jid_s, resource, availability, priority, statuses): 337 def setConnected(self, jid_s, resource, availability, priority, statuses):
337 """Set connection status 338 """Set connection status
338 @param jid_s (str): JID userhost as unicode 339 @param jid_s (unicode): JID userhost as unicode
339 """ 340 """
340 raise Exception("should not be there") # FIXME 341 raise Exception("should not be there") # FIXME
341 assert(jid_s == self.target.bare) 342 assert(jid_s == self.target.bare)
342 if self.type != C.CHAT_GROUP: 343 if self.type != C.CHAT_GROUP:
343 return 344 return