summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-04 18:23:10 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-04 21:05:47 +0200
commitbbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc (patch)
tree4ad7c355a84617e7f42f71e569665faf9d7db173 /src/core
parent36620901e85a02fec31256b30eec55c754c80e85 (diff)
downloadpoezio-bbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc.tar.gz
poezio-bbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc.tar.bz2
poezio-bbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc.tar.xz
poezio-bbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc.zip
Add the /ad-hoc <jid> command to list commands of the given jid
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commands.py16
-rw-r--r--src/core/core.py4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/core/commands.py b/src/core/commands.py
index d4df1099..c2e453e9 100644
--- a/src/core/commands.py
+++ b/src/core/commands.py
@@ -940,6 +940,22 @@ def command_xml_tab(self, arg=''):
tab = tabs.XMLTab()
self.add_tab(tab, True)
+def command_adhoc(self, arg):
+ arg = arg.split()
+ if len(arg) > 1:
+ return self.command_help('list')
+ elif arg:
+ jid = safeJID(arg[0]).server
+ else:
+ return self.information('Please provide a jid', 'Error')
+ list_tab = tabs.AdhocCommandsListTab(jid)
+ self.add_tab(list_tab, True)
+ cb = list_tab.on_list_received
+ self.xmpp.plugin['xep_0050'].get_commands(jid=jid,
+ local=False,
+ block=False,
+ callback=cb)
+
def command_self(self, arg=None):
"""
/self
diff --git a/src/core/core.py b/src/core/core.py
index d49845dc..d53782b5 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -1809,6 +1809,9 @@ class Core(object):
desc=_('Informs you of the last activity of a JID.'),
shortdesc=_('Get the activity of someone.'),
completion=self.completion_last_activity)
+ self.register_command('ad-hoc', self.command_adhoc,
+ usage='<jid>',
+ shortdesc=_('List available ad-hoc commands on the given jid'))
if config.get('enable_user_activity', True):
self.register_command('activity', self.command_activity,
@@ -1921,6 +1924,7 @@ class Core(object):
command_plugins = commands.command_plugins
command_message = commands.command_message
command_xml_tab = commands.command_xml_tab
+ command_adhoc = commands.command_adhoc
command_self = commands.command_self
completion_help = completions.completion_help
completion_status = completions.completion_status