diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-13 15:43:40 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-13 15:43:40 +0100 |
commit | 1fd21bc78360263efa529619221ad97f1bcf8e49 (patch) | |
tree | 61387120c07644326526a0bc2c6a30387e1a32dd /src | |
parent | 9d575afbf8715a97bf03f488a356348bf9870069 (diff) | |
download | poezio-1fd21bc78360263efa529619221ad97f1bcf8e49.tar.gz poezio-1fd21bc78360263efa529619221ad97f1bcf8e49.tar.bz2 poezio-1fd21bc78360263efa529619221ad97f1bcf8e49.tar.xz poezio-1fd21bc78360263efa529619221ad97f1bcf8e49.zip |
Completion for /server_cycle
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index c47a9751..ce675f04 100644 --- a/src/core.py +++ b/src/core.py @@ -128,7 +128,7 @@ class Core(object): 'message': (self.command_message, _('Usage: /message <jid> [optional message]\nMessage: Open a conversation with the specified JID (even if it is not in our roster), and send a message to it, if the message is specified.'), self.completion_version), 'version': (self.command_version, _('Usage: /version <jid>\nVersion: Get the software version of the given JID (usually its XMPP client and Operating System).'), self.completion_version), 'connect': (self.command_reconnect, _('Usage: /connect\nConnect: Disconnect from the remote server if you are currently connected and then connect to it again.'), None), - 'server_cycle': (self.command_server_cycle, _('Usage: /server_cycle [domain] [message]\nServer Cycle: Disconnect and reconnect in all the rooms in domain.'), None), + 'server_cycle': (self.command_server_cycle, _('Usage: /server_cycle [domain] [message]\nServer Cycle: Disconnect and reconnect in all the rooms in domain.'), self.completion_server_cycle), 'bind': (self.command_bind, _('Usage: /bind <key> <equ>\nBind: Bind a key to an other key or to a “command”. For example "/bind ^H KEY_UP" makes Control + h do the same same as the Up key.'), None), 'load': (self.command_load, _('Usage: /load <plugin>\nLoad: Load the specified plugin'), self.plugin_manager.completion_load), 'unload': (self.command_unload, _('Usage: /unload <plugin>\nUnload: Unload the specified plugin'), self.plugin_manager.completion_unload), @@ -1590,6 +1590,22 @@ class Core(object): msg = "%s=%s" % (option, value) self.information(msg, 'Info') + def completion_server_cycle(self, the_input): + """Completion for /server_cycle""" + txt = the_input.get_text() + args = txt.split() + n = len(args) + if txt.endswith(' '): + n += 1 + if n == 2: + serv_list = [] + for tab in self.tabs: + if isinstance(tab, tabs.MucTab): + serv = JID(tab.get_name()).server + if not serv in serv_list: + serv_list.append(serv) + return the_input.auto_completion(serv_list, ' ') + def completion_set(self, the_input): """Completion for /set""" txt = the_input.get_text() |