Mercurial > libervia-backend
comparison frontends/src/primitivus/chat.py @ 1377:017270e6eea4
quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
- QuickChat.occupants is now a property using cached information
- some MUC handlers are no more needed, the presence handler is enough
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 20 Mar 2015 16:25:38 +0100 |
parents | d3e9848b9574 |
children | 3dae6964c071 |
comparison
equal
deleted
inserted
replaced
1376:28fd9e838f8f | 1377:017270e6eea4 |
---|---|
224 self.subj_wid = urwid.Text(unicode(subject.replace('\n','|') if wrap == 'clip' else subject ), | 224 self.subj_wid = urwid.Text(unicode(subject.replace('\n','|') if wrap == 'clip' else subject ), |
225 align='left' if wrap=='clip' else 'center',wrap=wrap) | 225 align='left' if wrap=='clip' else 'center',wrap=wrap) |
226 self.chat_widget.header = urwid.AttrMap(self.subj_wid,'title') | 226 self.chat_widget.header = urwid.AttrMap(self.subj_wid,'title') |
227 self.host.redraw() | 227 self.host.redraw() |
228 | 228 |
229 def setPresents(self, nicks): | 229 def addUser(self, param_nick): |
230 """Set the occupants of a group chat. | |
231 | |
232 @param nicks (list[unicode]): sorted list of nicknames | |
233 """ | |
234 QuickChat.setPresents(self, nicks) | |
235 self.present_wid.changeValues(nicks) | |
236 self.host.redraw() | |
237 | |
238 def replaceUser(self, param_nick, show_info=True): | |
239 """Add user if it is not in the group list""" | 230 """Add user if it is not in the group list""" |
240 nick = unicode(param_nick) #FIXME: should be done in DBus bridge | 231 nick = unicode(param_nick) #FIXME: should be done in DBus bridge |
241 QuickChat.replaceUser(self, nick, show_info) | 232 QuickChat.addUser(self, nick) |
242 presents = self.present_wid.getAllValues() | 233 presents = self.present_wid.getAllValues() |
243 if nick not in [present.value for present in presents]: | 234 if nick not in [present.value for present in presents]: |
244 presents.append(nick) | 235 presents.append(nick) |
245 presents.sort(cmp=lambda a, b: cmp(a.value if hasattr(a, 'value') else a, b.value if hasattr(b, 'value') else b)) | 236 presents.sort(cmp=lambda a, b: cmp(a.value if hasattr(a, 'value') else a, b.value if hasattr(b, 'value') else b)) |
246 self.present_wid.changeValues(presents) | 237 self.present_wid.changeValues(presents) |
247 self.host.redraw() | 238 self.host.redraw() |
248 | 239 |
249 def removeUser(self, param_nick, show_info=True): | 240 def removeUser(self, param_nick): |
250 """Remove a user from the group list""" | 241 """Remove a user from the group list""" |
251 nick = unicode(param_nick) #FIXME: should be done in DBus bridge | 242 nick = unicode(param_nick) #FIXME: should be done in DBus bridge |
252 QuickChat.removeUser(self, nick, show_info) | 243 QuickChat.removeUser(self, nick) |
253 self.present_wid.deleteValue(nick) | 244 self.present_wid.deleteValue(nick) |
254 self.host.redraw() | 245 self.host.redraw() |
255 | 246 |
256 def clearHistory(self): | 247 def clearHistory(self): |
257 """Clear the content of this chat.""" | 248 """Clear the content of this chat.""" |