Mercurial > libervia-web
changeset 408:ee8ebfe23e16
browser_side: handle the signal "roomUserChangedNick"
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 17 Mar 2014 16:33:05 +0100 |
parents | 6a6551de4414 |
children | 35a43d0dc032 |
files | browser_side/panels.py libervia.py libervia_server/__init__.py |
diffstat | 3 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/browser_side/panels.py Sun Mar 16 21:03:50 2014 +0100 +++ b/browser_side/panels.py Mon Mar 17 16:33:05 2014 +0100 @@ -1159,6 +1159,12 @@ self.occupants_list.removeOccupant(nick) self.printInfo("<= %s has left the room" % nick) + def changeUserNick(self, old_nick, new_nick): + assert(self.type == "group") + self.occupants_list.removeOccupant(old_nick) + self.occupants_list.addOccupant(new_nick) + self.printInfo(_("%(old_nick)s is now known as %(new_nick)s") % {'old_nick': old_nick, 'new_nick': new_nick}) + def historyPrint(self, size=20): """Print the initial history""" def getHistoryCB(history):
--- a/libervia.py Sun Mar 16 21:03:50 2014 +0100 +++ b/libervia.py Mon Mar 17 16:33:05 2014 +0100 @@ -426,6 +426,8 @@ self._roomUserJoinedCb(*args) elif name == 'roomUserLeft': self._roomUserLeftCb(*args) + elif name == 'roomUserChangedNick': + self._roomUserChangedNickCb(*args) elif name == 'askConfirmation': self._askConfirmation(*args) elif name == 'newAlert': @@ -703,6 +705,12 @@ if isinstance(lib_wid, panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: lib_wid.userLeft(user_nick, user_data) + def _roomUserChangedNickCb(self, room_jid_s, old_nick, new_nick): + """Called when an user joined a MUC room""" + for lib_wid in self.libervia_widgets: + if isinstance(lib_wid, panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: + lib_wid.changeUserNick(old_nick, new_nick) + def _tarotGameStartedCb(self, waiting, room_jid_s, referee, players): for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s:
--- a/libervia_server/__init__.py Sun Mar 16 21:03:50 2014 +0100 +++ b/libervia_server/__init__.py Mon Mar 17 16:33:05 2014 +0100 @@ -988,7 +988,7 @@ for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 'tarotGamePlayers', 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected', 'radiocolPlayers', - 'roomLeft', 'chatStateReceived']: + 'roomLeft', 'roomUserChangedNick', 'chatStateReceived']: self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") self.media_dir = self.bridge.getConfig('','media_dir') self.local_dir = self.bridge.getConfig('','local_dir')