Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_app.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 | 65ecbb473cbb |
children | 886754295efe |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py Thu Sep 27 00:54:42 2012 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Fri Sep 28 00:26:24 2012 +0200 @@ -57,8 +57,10 @@ self.bridge.register("actionResult", self.actionResult) self.bridge.register("actionResultExt", self.actionResult) self.bridge.register("roomJoined", self.roomJoined, "plugin") + self.bridge.register("roomLeft", self.roomLeft, "plugin") self.bridge.register("roomUserJoined", self.roomUserJoined, "plugin") self.bridge.register("roomUserLeft", self.roomUserLeft, "plugin") + self.bridge.register("roomUserChangedNick", self.roomUserChangedNick, "plugin") self.bridge.register("roomNewSubject", self.roomNewSubject, "plugin") self.bridge.register("tarotGameStarted", self.tarotGameStarted, "plugin") self.bridge.register("tarotGameNew", self.tarotGameNew, "plugin") @@ -290,6 +292,13 @@ self.chat_wins[room_jid].setPresents(list(set([user_nick]+room_nicks))) self.contact_list.setSpecial(JID(room_jid), "MUC") + def roomLeft(self, room_jid, profile): + """Called when a MUC room is left""" + if not self.check_profile(profile): + return + debug (_("Room [%(room_jid)s] left by %(profile)s") % {'room_jid':room_jid, 'profile': profile}) + del self.chat_wins[room_jid] + self.contact_list.remove(room_jid) def roomUserJoined(self, room_jid, user_nick, user_data, profile): """Called when an user joined a MUC room""" @@ -307,6 +316,14 @@ self.chat_wins[room_jid].removeUser(user_nick) debug (_("user [%(user_nick)s] left room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid}) + def roomUserChangedNick(self, room_jid, old_nick, new_nick, profile): + """Called when an user joined a MUC room""" + if not self.check_profile(profile): + return + if self.chat_wins.has_key(room_jid): + self.chat_wins[room_jid].changeUserNick(old_nick, new_nick) + debug (_("user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]") % {'old_nick':old_nick, 'new_nick':new_nick, 'room_jid':room_jid}) + def roomNewSubject(self, room_jid, subject, profile): """Called when subject of MUC room change""" if not self.check_profile(profile):