diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-13 16:28:11 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-13 16:28:11 +0100 |
commit | 552c504559eef91a525f1794d4954f311314d075 (patch) | |
tree | a1f4495ef436c87c99bfb5a5e02e121903d1e7e6 | |
parent | 3ddbac5e47c166fc28cd285e0e299e6e7b9bc09a (diff) | |
download | poezio-552c504559eef91a525f1794d4954f311314d075.tar.gz poezio-552c504559eef91a525f1794d4954f311314d075.tar.bz2 poezio-552c504559eef91a525f1794d4954f311314d075.tar.xz poezio-552c504559eef91a525f1794d4954f311314d075.zip |
Completion for /affiliation
-rw-r--r-- | src/tabs.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/tabs.py b/src/tabs.py index ebb2a0e6..38737890 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -476,7 +476,7 @@ class MucTab(ChatTab): self.commands['unignore'] = (self.command_unignore, _("Usage: /unignore <nickname>\nUnignore: Remove the specified nickname from the ignore list."), self.completion_unignore) self.commands['kick'] = (self.command_kick, _("Usage: /kick <nick> [reason]\nKick: Kick the user with the specified nickname. You also can give an optional reason."), self.completion_ignore) self.commands['role'] = (self.command_role, _("Usage: /role <nick> <role> [reason]\nRole: Set the role of an user. Roles can be: none, visitor, participant, moderator. You also can give an optional reason."), self.completion_role) - self.commands['affiliation'] = (self.command_affiliation, _("Usage: /affiliation <nick> <affiliation> [reason]\nAffiliation: Set the affiliation of an user. Affiliations can be: none, member, admin, owner. You also can give an optional reason."), None) + self.commands['affiliation'] = (self.command_affiliation, _("Usage: /affiliation <nick> <affiliation> [reason]\nAffiliation: Set the affiliation of an user. Affiliations can be: none, member, admin, owner. You also can give an optional reason."), self.completion_affiliation) self.commands['topic'] = (self.command_topic, _("Usage: /topic <subject>\nTopic: Change the subject of the room."), self.completion_topic) self.commands['query'] = (self.command_query, _('Usage: /query <nick> [message]\nQuery: Open a private conversation with <nick>. 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.'), None) self.commands['part'] = (self.command_part, _("Usage: /part [message]\nPart: Disconnect from a room. You can specify an optional message."), None) @@ -512,6 +512,20 @@ class MucTab(ChatTab): possible_roles = ['none', 'visitor', 'participant', 'moderator'] return the_input.auto_completion(possible_roles, '') + def completion_affiliation(self, the_input): + """Completion for /affiliation""" + text = the_input.get_text() + args = common.shell_split(text) + n = len(args) + if text.endswith(' '): + n += 1 + if n == 2: + userlist = [user.nick for user in self.users] + return the_input.auto_completion(userlist, '') + elif n == 3: + possible_affiliations = ['none', 'member', 'admin', 'owner'] + return the_input.auto_completion(possible_affiliations, '') + def scroll_user_list_up(self): self.user_win.scroll_up() self.user_win.refresh(self.users) |