summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.py2
-rw-r--r--src/gui.py14
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)
diff --git a/src/gui.py b/src/gui.py
index f749261a..91e1fa34 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -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)