diff options
Diffstat (limited to 'sleekxmpp/plugins/xep_0030')
-rw-r--r-- | sleekxmpp/plugins/xep_0030/disco.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py index 83d7a9c0..53086d4e 100644 --- a/sleekxmpp/plugins/xep_0030/disco.py +++ b/sleekxmpp/plugins/xep_0030/disco.py @@ -268,7 +268,7 @@ class xep_0030(base_plugin): """ if local or jid is None: log.debug("Looking up local disco#info data " + \ - "for %s, node %s." % (jid, node)) + "for %s, node %s.", jid, node) info = self._run_node_handler('get_info', jid, node, kwargs) return self._fix_default_info(info) @@ -542,7 +542,7 @@ class xep_0030(base_plugin): """ if iq['type'] == 'get': log.debug("Received disco info query from " + \ - "<%s> to <%s>." % (iq['from'], iq['to'])) + "<%s> to <%s>.", iq['from'], iq['to']) if self.xmpp.is_component: jid = iq['to'].full else: @@ -551,14 +551,17 @@ class xep_0030(base_plugin): jid, iq['disco_info']['node'], iq) - iq.reply() - if info: - info = self._fix_default_info(info) - iq.set_payload(info.xml) - iq.send() + if isinstance(info, Iq): + info.send() + else: + iq.reply() + if info: + info = self._fix_default_info(info) + iq.set_payload(info.xml) + iq.send() elif iq['type'] == 'result': log.debug("Received disco info result from" + \ - "%s to %s." % (iq['from'], iq['to'])) + "%s to %s.", iq['from'], iq['to']) self.xmpp.event('disco_info', iq) def _handle_disco_items(self, iq): @@ -572,21 +575,25 @@ class xep_0030(base_plugin): """ if iq['type'] == 'get': log.debug("Received disco items query from " + \ - "<%s> to <%s>." % (iq['from'], iq['to'])) + "<%s> to <%s>.", iq['from'], iq['to']) if self.xmpp.is_component: jid = iq['to'].full else: jid = iq['to'].bare items = self._run_node_handler('get_items', jid, - iq['disco_items']['node']) - iq.reply() - if items: - iq.set_payload(items.xml) - iq.send() + iq['disco_items']['node'], + iq) + if isinstance(items, Iq): + items.send() + else: + iq.reply() + if items: + iq.set_payload(items.xml) + iq.send() elif iq['type'] == 'result': log.debug("Received disco items result from" + \ - "%s to %s." % (iq['from'], iq['to'])) + "%s to %s.", iq['from'], iq['to']) self.xmpp.event('disco_items', iq) def _fix_default_info(self, info): |