plugin XEP-0050: return disco for commands only on commands namespace

This commit is contained in:
Goffi 2015-08-25 20:02:50 +02:00
commit 94eaf21945

View file

@ -113,6 +113,8 @@ class AdHocCommand(XMPPHandler):
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 @@ class XEP_0050(object):
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