diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-01-30 03:06:38 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-01-30 03:06:38 +0000 |
commit | e5683d781d0783ebf13eaed8c3d421f1edd00fb5 (patch) | |
tree | 6bc67090a990fd16a95f43c7a95c30dab6fde4e5 | |
parent | 95c7ad4ac82762e3e017cd8ef85d267add803126 (diff) | |
download | poezio-e5683d781d0783ebf13eaed8c3d421f1edd00fb5.tar.gz poezio-e5683d781d0783ebf13eaed8c3d421f1edd00fb5.tar.bz2 poezio-e5683d781d0783ebf13eaed8c3d421f1edd00fb5.tar.xz poezio-e5683d781d0783ebf13eaed8c3d421f1edd00fb5.zip |
/nick
-rw-r--r-- | src/client.py | 2 | ||||
-rw-r--r-- | src/gui.py | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/client.py b/src/client.py index 6ed27272..47a87071 100644 --- a/src/client.py +++ b/src/client.py @@ -25,7 +25,7 @@ from handler import Handler from gui import Gui from curses import wrapper, initscr -sys.stderr = open('logs', 'a') +# sys.stderr = open('logs', 'a') if len(sys.argv) == 1: # not debug, so hide any error message and disable C-c import signal signal.signal(signal.SIGINT, signal.SIG_IGN) @@ -95,7 +95,10 @@ class Room(object): for user in self.users: if user.nick == nick: if change_nick: + if user.nick == self.own_nick: + self.own_nick = stanza.getNick().encode('utf-8') user.change_nick(stanza.getNick()) + return self.add_info('%s is now known as %s' % (nick, stanza.getNick())) if kick: self.users.remove(user) @@ -144,6 +147,7 @@ class Gui(object): 'quit': self.command_quit, 'next': self.rotate_rooms_left, 'prev': self.rotate_rooms_right, + 'nick': self.command_nick, } self.key_func = { @@ -294,6 +298,7 @@ class Gui(object): def execute(self): line = self.window.input.get_text() self.window.input.clear_text() + self.window.input.refresh() curses.doupdate() if line == "": return @@ -323,6 +328,15 @@ class Gui(object): if not r: # if the room window exist, we don't recreate it. self.join_room(room, nick) + def command_nick(self, args): + if len(args) != 1: + return + nick = args[0] + room = self.current_room() + if not room.joined or room.name == "Info": + return + self.muc.change_nick(room.name, nick) + def information(self, msg): room = self.get_room_by_name("Info") info = room.add_info(msg) |