changeset 1494:74ddb4cc2ff9

plugin XEP-0050: return disco for commands only on commands namespace
author Goffi <goffi@goffi.org>
date Tue, 25 Aug 2015 20:02:50 +0200
parents 1285c714a6cc
children 987e74cbb839
files src/plugins/plugin_xep_0050.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0050.py	Tue Aug 25 16:52:18 2015 +0200
+++ b/src/plugins/plugin_xep_0050.py	Tue Aug 25 20:02:50 2015 +0200
@@ -113,6 +113,8 @@
         return False
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
+        if nodeIdentifier != NS_COMMANDS: # FIXME: we should manage other disco nodes here
+            return []
         # identities = [ID_CMD_LIST if self.node == NS_COMMANDS else ID_CMD_NODE] # FIXME
         return [disco.DiscoFeature(NS_COMMANDS)] + self.features
 
@@ -460,13 +462,13 @@
         d.addCallback(self._items2XMLUI)
         return d
 
-    def addAdHocCommand(self, callback, label, node="", features = None, timeout = 600, allowed_jids = None, allowed_groups = None,
+    def addAdHocCommand(self, callback, label, node=None, features = None, timeout = 600, allowed_jids = None, allowed_groups = None,
                         allowed_magics = None, forbidden_jids = None, forbidden_groups = None, profile_key=C.PROF_KEY_NONE):
         """Add an ad-hoc command for the current profile
 
         @param callback: method associated with this ad-hoc command which return the payload data (see AdHocCommand._sendAnswer), can return a deferred
         @param label: label associated with this command on the main menu
-        @param node: disco item node associated with this command. None or "" to use autogenerated node
+        @param node: disco item node associated with this command. None to use autogenerated node
         @param features: features associated with the payload (list of strings), usualy data form
         @param timeout: delay between two requests before canceling the session (in seconds)
         @param allowed_jids: list of allowed entities