Mercurial > libervia-backend
comparison frontends/src/primitivus/chat.py @ 507:f98bef71a918
frontends, core, plugin XEP-0045: leave implementation + better nick change
- memory: individual entity cache can be deleted
- plugin XEP-0045: nick change are now detected and userChangedNick signal is sent instead of joined/left
- plugin XEP-0045: leave implementation
- frontends: userChangedNick signal management
- Primitivus: an alert is shown in notification bar in case of error in sendMessage
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 28 Sep 2012 00:26:24 +0200 |
parents | e9634d2e7b38 |
children | 886754295efe |
comparison
equal
deleted
inserted
replaced
506:2e43c74815ad | 507:f98bef71a918 |
---|---|
201 nicks.sort() | 201 nicks.sort() |
202 QuickChat.setPresents(self, nicks) | 202 QuickChat.setPresents(self, nicks) |
203 self.present_wid.changeValues(nicks) | 203 self.present_wid.changeValues(nicks) |
204 self.host.redraw() | 204 self.host.redraw() |
205 | 205 |
206 def replaceUser(self, param_nick): | 206 def replaceUser(self, param_nick, show_info=True): |
207 """Add user if it is not in the group list""" | 207 """Add user if it is not in the group list""" |
208 nick = unicode(param_nick) #FIXME: should be done in DBus bridge | 208 nick = unicode(param_nick) #FIXME: should be done in DBus bridge |
209 QuickChat.replaceUser(self, nick) | 209 QuickChat.replaceUser(self, nick, show_info) |
210 presents = self.present_wid.getAllValues() | 210 presents = self.present_wid.getAllValues() |
211 if nick not in presents: | 211 if nick not in presents: |
212 presents.append(nick) | 212 presents.append(nick) |
213 presents.sort() | 213 presents.sort() |
214 self.present_wid.changeValues(presents) | 214 self.present_wid.changeValues(presents) |
215 self.host.redraw() | 215 self.host.redraw() |
216 | 216 |
217 def removeUser(self, param_nick): | 217 def removeUser(self, param_nick, show_info=True): |
218 """Remove a user from the group list""" | 218 """Remove a user from the group list""" |
219 nick = unicode(param_nick) #FIXME: should be done in DBus bridge | 219 nick = unicode(param_nick) #FIXME: should be done in DBus bridge |
220 QuickChat.removeUser(self, nick) | 220 QuickChat.removeUser(self, nick, show_info) |
221 self.present_wid.deleteValue(nick) | 221 self.present_wid.deleteValue(nick) |
222 self.host.redraw() | 222 self.host.redraw() |
223 | 223 |
224 def printMessage(self, from_jid, msg, profile, timestamp=""): | 224 def printMessage(self, from_jid, msg, profile, timestamp=""): |
225 assert isinstance(from_jid, JID) | 225 assert isinstance(from_jid, JID) |
232 if self.text_list.get_focus()[1] == len(self.content)-2: | 232 if self.text_list.get_focus()[1] == len(self.content)-2: |
233 #we don't change focus if user is not at the bottom | 233 #we don't change focus if user is not at the bottom |
234 #as that mean that he is probably watching discussion history | 234 #as that mean that he is probably watching discussion history |
235 self.text_list.set_focus(len(self.content)-1) | 235 self.text_list.set_focus(len(self.content)-1) |
236 self.host.redraw() | 236 self.host.redraw() |
237 if not self.host.notify.hasFocus(): | 237 if not self.host.x_notify.hasFocus(): |
238 if self.type=="one2one": | 238 if self.type=="one2one": |
239 self.host.notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid) | 239 self.host.x_notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid) |
240 elif self.getUserNick().lower() in msg.lower(): | 240 elif self.getUserNick().lower() in msg.lower(): |
241 self.host.notify.sendNotification(_("Primitivus: Somebody pinged your name in %s room") % self.target) | 241 self.host.x_notify.sendNotification(_("Primitivus: Somebody pinged your name in %s room") % self.target) |
242 | 242 |
243 def printInfo(self, msg, type='normal'): | 243 def printInfo(self, msg, type='normal'): |
244 """Print general info | 244 """Print general info |
245 @param msg: message to print | 245 @param msg: message to print |
246 @type: one of: | 246 @type: one of: |
251 if self.text_list.get_focus()[1] == len(self.content)-2: | 251 if self.text_list.get_focus()[1] == len(self.content)-2: |
252 #we don't change focus if user is not at the bottom | 252 #we don't change focus if user is not at the bottom |
253 #as that mean that he is probably watching discussion history | 253 #as that mean that he is probably watching discussion history |
254 self.text_list.set_focus(len(self.content)-1) | 254 self.text_list.set_focus(len(self.content)-1) |
255 self.host.redraw() | 255 self.host.redraw() |
256 if not self.host.notify.hasFocus(): | 256 if not self.host.x_notify.hasFocus(): |
257 if self.type=="one2one": | 257 if self.type=="one2one": |
258 self.host.notify.sendNotification(_("Primitivus: there is a message about you")) | 258 self.host.x_notify.sendNotification(_("Primitivus: there is a message about you")) |
259 elif self.getUserNick().lower() in msg.lower(): | 259 elif self.getUserNick().lower() in msg.lower(): |
260 self.host.notify.sendNotification(_("Primitivus: Somebody is talking about you in %s room") % self.target) | 260 self.host.x_notify.sendNotification(_("Primitivus: Somebody is talking about you in %s room") % self.target) |
261 | 261 |
262 def startGame(self, game_type, referee, players): | 262 def startGame(self, game_type, referee, players): |
263 """Configure the chat window to start a game""" | 263 """Configure the chat window to start a game""" |
264 if game_type=="Tarot": | 264 if game_type=="Tarot": |
265 self.tarot_wid = CardGame(self, referee, players, self.nick) | 265 self.tarot_wid = CardGame(self, referee, players, self.nick) |