From 34511797a93497409d828b9fa87621ad5ff63672 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 Nov 2011 17:36:16 +0100 Subject: Completion for /nick --- src/tabs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tabs.py b/src/tabs.py index 54207ba9..feb4be37 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -481,7 +481,7 @@ class MucTab(ChatTab): self.commands['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.'), self.completion_ignore) self.commands['part'] = (self.command_part, _("Usage: /part [message]\nPart: Disconnect from a room. You can specify an optional message."), None) self.commands['close'] = (self.command_close, _("Usage: /close [message]\nClose: Disconnect from a room and close the tab. You can specify an optional message if you are still connected."), None) - self.commands['nick'] = (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room."), None) + self.commands['nick'] = (self.command_nick, _("Usage: /nick \nNick: Change your nickname in the current room."), self.completion_nick) 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: Leave the current room and rejoin it immediately.'), None) self.commands['info'] = (self.command_info, _('Usage: /info \nInfo: Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.'), self.completion_ignore) @@ -491,6 +491,13 @@ class MucTab(ChatTab): self.resize() self.update_commands() + def completion_nick(self, the_input): + """Completion for /nick""" + nicks = [os.environ.get('USER'), config.get('default_nick', ''), self.core.get_bookmark_nickname(self.get_name())] + while nicks.count(''): + nicks.remove('') + return the_input.auto_completion(nicks, '') + def completion_ignore(self, the_input): """Completion for /ignore""" userlist = [user.nick for user in self.users] -- cgit v1.2.3