correctly answer on disco#items on our ad hoc commands
This commit is contained in:
parent
eba6959612
commit
c94d22dcb1
|
@ -306,8 +306,8 @@ class ConnectionCommands:
|
|||
|
||||
self.connection.send(iq)
|
||||
|
||||
def commandQuery(self, con, iq_obj):
|
||||
''' Send disco result for query for command (JEP-0050, example 6.).
|
||||
def commandInfoQuery(self, con, iq_obj):
|
||||
''' Send disco#info result for query for command (JEP-0050, example 6.).
|
||||
Return True if the result was sent, False if not. '''
|
||||
jid = helpers.get_full_jid_from_iq(iq_obj)
|
||||
node = iq_obj.getTagAttr('query', 'node')
|
||||
|
@ -330,6 +330,22 @@ class ConnectionCommands:
|
|||
|
||||
return False
|
||||
|
||||
def commandItemsQuery(self, con, iq_obj):
|
||||
''' Send disco#items result for query for command.
|
||||
Return True if the result was sent, False if not. '''
|
||||
jid = helpers.get_full_jid_from_iq(iq_obj)
|
||||
node = iq_obj.getTagAttr('query', 'node')
|
||||
|
||||
if node not in self.__commands: return False
|
||||
|
||||
cmd = self.__commands[node]
|
||||
if cmd.isVisibleFor(self.isSameJID(jid)):
|
||||
iq = iq_obj.buildReply('result')
|
||||
self.connection.send(iq)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def _CommandExecuteCB(self, con, iq_obj):
|
||||
jid = helpers.get_full_jid_from_iq(iq_obj)
|
||||
|
||||
|
|
|
@ -711,6 +711,8 @@ class ConnectionDisco:
|
|||
|
||||
def _DiscoverItemsGetCB(self, con, iq_obj):
|
||||
gajim.log.debug('DiscoverItemsGetCB')
|
||||
if self.commandItemsQuery(con, iq_obj):
|
||||
raise common.xmpp.NodeProcessed
|
||||
node = iq_obj.getTagAttr('query', 'node')
|
||||
if node is None:
|
||||
result = iq_obj.buildReply('result')
|
||||
|
@ -725,7 +727,7 @@ class ConnectionDisco:
|
|||
q = iq_obj.getTag('query')
|
||||
node = q.getAttr('node')
|
||||
|
||||
if self.commandQuery(con, iq_obj):
|
||||
if self.commandInfoQuery(con, iq_obj):
|
||||
raise common.xmpp.NodeProcessed
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue