summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-13 14:28:25 +0100
committermathieui <mathieui@mathieui.net>2011-11-13 14:28:25 +0100
commit6dfc2ef9b5bb05cce00964ca7bace635e47f38be (patch)
tree06364689d60eb5ed2859bf87f72152119de48b3d /src
parent7d52e1be616dfc69f3c9281ba51bcd2b999d8bf8 (diff)
downloadpoezio-6dfc2ef9b5bb05cce00964ca7bace635e47f38be.tar.gz
poezio-6dfc2ef9b5bb05cce00964ca7bace635e47f38be.tar.bz2
poezio-6dfc2ef9b5bb05cce00964ca7bace635e47f38be.tar.xz
poezio-6dfc2ef9b5bb05cce00964ca7bace635e47f38be.zip
Completion for /presence
Diffstat (limited to 'src')
-rw-r--r--src/core.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index dd2690f4..751b21f1 100644
--- a/src/core.py
+++ b/src/core.py
@@ -133,7 +133,7 @@ class Core(object):
'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),
'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None),
- 'presence': (self.command_presence, _('Usage: /presence <JID> [type] [status]\nPresence: Send a directed presence to <JID> and using [type] and [status] if provided.'), None),
+ 'presence': (self.command_presence, _('Usage: /presence <JID> [type] [status]\nPresence: Send a directed presence to <JID> and using [type] and [status] if provided.'), self.completion_presence),
'rawxml': (self.command_rawxml, _('Usage: /rawxml\nRawXML: Send a custom xml stanza.'), None),
'set_plugin': (self.command_set_plugin, _("Usage: /set_plugin <plugin> <option> [value]\nSet Plugin: Set the value of the option in a plugin configuration file."), None),
}
@@ -1209,8 +1209,25 @@ class Core(object):
log.debug(_("Could not send directed presence:\n") + traceback.format_exc())
def completion_status(self, the_input):
+ """
+ Completion of /status
+ """
return the_input.auto_completion([status for status in possible_show], ' ')
+ def completion_presence(self, the_input):
+ """
+ Completion of /presence
+ """
+ text = the_input.get_text()
+ args = text.split()
+ n = len(args)
+ if text.endswith(' '):
+ n += 1
+ if n == 2:
+ return the_input.auto_completion([contact.bare_jid for contact in roster.get_contacts()], '')
+ elif n == 3:
+ return the_input.auto_completion([status for status in possible_show], '')
+
def command_load(self, arg):
"""
/load <plugin>