From 6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sat, 7 Aug 2010 00:28:47 +0000 Subject: Begin of a /whois command. Also, ALSMO fixed 1710 --- src/gui.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gui.py') diff --git a/src/gui.py b/src/gui.py index da3f066a..21d69a0a 100644 --- a/src/gui.py +++ b/src/gui.py @@ -97,6 +97,7 @@ class Gui(object): 'query': (self.command_query, _('Usage: /query [message]\nQuery: Open a private conversation with . This nick has to be present in the room you\'re currently in. If you specified a message after the nickname, it will immediately be sent to this user')), 'nick': (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room")), 'say': (self.command_say, _('Usage: /say \nSay: Just send the message. Useful if you want your message to begin with a "/"')), + 'whois': (self.command_whois, _('Usage: /whois \nWhois: Request many informations about the user.')), } self.key_func = { @@ -157,6 +158,10 @@ class Gui(object): while True: doupdate() char=read_char(stdscr) + try: # if this is not a valide utf-8 char, discard it + char.encode('utf-8') + except UnicodeDecodeError: + continue # search for keyboard shortcut if char in self.key_func.keys(): self.key_func[char]() @@ -646,6 +651,21 @@ class Gui(object): msg = _('Unknown command: %s') % args[0] self.add_message_to_room(room, msg) + def command_whois(self, arg): + """ + /whois + """ + args = arg.split() + room = self.current_room() + if len(args) != 1: + self.add_message_to_room(room, _('whois command takes exactly one argument')) + return + # check if current room is a MUC + if room.jid or room.name == 'Info': + return + nickname = args[0] + self.muc.request_vcard(room.name, nickname) + def command_win(self, arg): """ /win -- cgit v1.2.3