From 33c69df12b1621129b7af1a21eb180454d01e21b Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 17 Jan 2011 16:25:15 +0100 Subject: /info command (to see user's affiliation, role, etc) --- src/tabs.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 83dc9079..19688713 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -367,6 +367,7 @@ class MucTab(ChatTab): self.commands['nick'] = (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room"), None) self.commands['recolor'] = (self.command_recolor, _('Usage: /recolor\nRecolor: Re-assign a color to all participants of the current room, based on the last time they talked. Use this if the participants currently talking have too many identical colors.'), None) self.commands['cycle'] = (self.command_cycle, _('Usage: /cycle [message]\nCycle: Leaves the current room and rejoin it immediately'), None) + self.commands['info'] = (self.command_info, _('Usage: /info \nInfoDisplay some information about the user in the MUC: his/here role, affiliation, status and status message.'), None) self.resize() def scroll_user_list_up(self): @@ -377,6 +378,19 @@ class MucTab(ChatTab): self.user_win.scroll_down() self.core.refresh_window() + def command_info(self, arg): + try: + args = shlex.split(arg) + except ValueError as error: + return self.core.information(str(error), _("Error")) + if len(args) != 1: + return self.core.information("Info command takes only 1 argument") + user = self.get_room().get_user_by_name(args[0]) + if not user: + return self.core.information("Unknown user: %s" % args[0]) + self.get_room().add_message("%s: show: %s, affiliation: %s, role: %s\n%s"% (args[0], user.show or 'Available', user.role or 'None', user.affiliation or 'None', user.status)) + self.core.refresh_window() + def command_cycle(self, arg): if self.get_room().joined: muc.leave_groupchat(self.core.xmpp, self.get_name(), self.get_room().own_nick, arg) -- cgit v1.2.3