diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-01-17 16:25:15 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-01-17 16:25:15 +0100 |
commit | 33c69df12b1621129b7af1a21eb180454d01e21b (patch) | |
tree | 13b956f36b2d876843341580c70cf94e49cdb07f /src | |
parent | 1fe6160cfc5ee86bd6582195a7f7b49a81170eaa (diff) | |
download | poezio-33c69df12b1621129b7af1a21eb180454d01e21b.tar.gz poezio-33c69df12b1621129b7af1a21eb180454d01e21b.tar.bz2 poezio-33c69df12b1621129b7af1a21eb180454d01e21b.tar.xz poezio-33c69df12b1621129b7af1a21eb180454d01e21b.zip |
/info command (to see user's affiliation, role, etc)
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 22 | ||||
-rw-r--r-- | src/tabs.py | 14 |
2 files changed, 14 insertions, 22 deletions
diff --git a/src/core.py b/src/core.py index 20b41d00..7d837202 100644 --- a/src/core.py +++ b/src/core.py @@ -122,7 +122,6 @@ class Core(object): 'available': (self.command_avail, _("Usage: /available [message]\nAvailable: Sets your availability to available and (optional) sets your status message. This is equivalent to '/show available [message]'"), None), 'bookmark': (self.command_bookmark, _("Usage: /bookmark [roomname][/nick]\nBookmark: Bookmark the specified room (you will then auto-join it on each poezio start). This commands uses the same syntaxe as /join. Type /help join for syntaxe examples. Note that when typing \"/bookmark\" on its own, the room will be bookmarked with the nickname you\'re currently using in this room (instead of default_nick)"), None), 'set': (self.command_set, _("Usage: /set <option> [value]\nSet: Sets the value to the option in your configuration file. You can, for example, change your default nickname by doing `/set default_nick toto` or your resource with `/set resource blabla`. You can also set an empty value (nothing) by providing no [value] after <option>."), None), - 'whois': (self.command_whois, _('Usage: /whois <nickname>\nWhois: Request many informations about the user.'), None), 'theme': (self.command_theme, _('Usage: /theme\nTheme: Reload the theme defined in the config file.'), None), 'list': (self.command_list, _('Usage: /list\n/List: get the list of public chatrooms on the specified server'), self.completion_list), } @@ -971,27 +970,6 @@ class Core(object): self.add_tab(list_tab, True) self.xmpp.plugin['xep_0030'].get_items(jid=server, block=False, callback=list_tab.on_muc_list_item_received) - def command_whois(self, arg): - """ - /whois <nickname> - """ - # TODO - return - # check shlex here - try: - args = shlex.split(arg) - except ValueError as error: - return self.information(str(error), _("Error")) - room = self.current_room() - if len(args) != 1: - self.add_message_to_text_buffer(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_theme(self, arg): """ """ 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 <nickname>\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 <nickname>\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) |