This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-01-30 03:06:38 +00:00
parent 95c7ad4ac8
commit e5683d781d
2 changed files with 15 additions and 1 deletions

View file

@ -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)

View file

@ -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)