Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2007-12-01 14:46:46 +0300
committerYann Leboulanger <asterix@lagaule.org>2007-12-01 14:46:46 +0300
commitc94d22dcb120a040a5f1211ddc9b9bd231b16345 (patch)
tree4e6bcff9c71bc37fefedfb79c576c219e77581e7
parenteba69596125852873e3c1226a24d79a567e3647a (diff)
correctly answer on disco#items on our ad hoc commands
-rw-r--r--src/common/commands.py20
-rw-r--r--src/common/connection_handlers.py4
2 files changed, 21 insertions, 3 deletions
diff --git a/src/common/commands.py b/src/common/commands.py
index 3aae5d53e..8edaf4356 100644
--- a/src/common/commands.py
+++ b/src/common/commands.py
@@ -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)
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index 92e6be95f..20c2aadcd 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -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: