diff options
author | Lance Stout <lancestout@gmail.com> | 2011-12-12 19:38:32 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-12-12 19:38:32 -0800 |
commit | fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b (patch) | |
tree | 4bf605d3a956b23e5515cf64ed6628f0013f08f3 /sleekxmpp/plugins/xep_0030/disco.py | |
parent | 85e9042db6f8432c36af18d5b9e6d55187e1f26e (diff) | |
download | slixmpp-fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b.tar.gz slixmpp-fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b.tar.bz2 slixmpp-fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b.tar.xz slixmpp-fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b.zip |
Allow disco info/items handlers to return full Iq stanzas.
Only allowing handlers to return a DiscoInfo/DiscoItem stanza works
for the majority of cases, but does not allow for the addition of
an RSM stanza, or other extensions.
An Iq stanza returned by a handler must already be configured as
a reply.
Diffstat (limited to 'sleekxmpp/plugins/xep_0030/disco.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0030/disco.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py index b08ce50d..53086d4e 100644 --- a/sleekxmpp/plugins/xep_0030/disco.py +++ b/sleekxmpp/plugins/xep_0030/disco.py @@ -551,11 +551,14 @@ 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']) @@ -581,10 +584,13 @@ class xep_0030(base_plugin): jid, iq['disco_items']['node'], iq) - iq.reply() - if items: - iq.set_payload(items.xml) - iq.send() + 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']) |