summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-08 16:49:16 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-08-08 16:49:16 +0200
commit37d1f2a6b09a4352c93913fa4c92153c4ca80cb4 (patch)
treec94bb934187f911b26f52b690dd71f2da0ea1ebe
parent20107ad516640a6f7bc8827ca85020fade18344d (diff)
downloadslixmpp-37d1f2a6b09a4352c93913fa4c92153c4ca80cb4.tar.gz
slixmpp-37d1f2a6b09a4352c93913fa4c92153c4ca80cb4.tar.bz2
slixmpp-37d1f2a6b09a4352c93913fa4c92153c4ca80cb4.tar.xz
slixmpp-37d1f2a6b09a4352c93913fa4c92153c4ca80cb4.zip
xep_0092: Send a <forbidden/> error if we don’t want to send our version. (thanks lovetox!)
-rw-r--r--slixmpp/plugins/xep_0092/version.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/slixmpp/plugins/xep_0092/version.py b/slixmpp/plugins/xep_0092/version.py
index 839f740d..35c2c5ce 100644
--- a/slixmpp/plugins/xep_0092/version.py
+++ b/slixmpp/plugins/xep_0092/version.py
@@ -65,9 +65,14 @@ class XEP_0092(BasePlugin):
iq -- The Iq stanza containing the software version query.
"""
iq = iq.reply()
- iq['software_version']['name'] = self.software_name
- iq['software_version']['version'] = self.version
- iq['software_version']['os'] = self.os
+ if self.software_name:
+ iq['software_version']['name'] = self.software_name
+ iq['software_version']['version'] = self.version
+ iq['software_version']['os'] = self.os
+ else:
+ iq.error()
+ iq['error']['type'] = 'cancel'
+ iq['error']['condition'] = 'forbidden'
iq.send()
def get_version(self, jid, ifrom=None, timeout=None, callback=None,