summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0092
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0092')
-rw-r--r--sleekxmpp/plugins/xep_0092/version.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py
index 463da158..b16ad516 100644
--- a/sleekxmpp/plugins/xep_0092/version.py
+++ b/sleekxmpp/plugins/xep_0092/version.py
@@ -30,16 +30,18 @@ class XEP_0092(BasePlugin):
description = 'XEP-0092: Software Version'
dependencies = set(['xep_0030'])
stanza = stanza
+ default_config = {
+ 'software_name': 'SleekXMPP',
+ 'version': sleekxmpp.__version__,
+ 'os': ''
+ }
def plugin_init(self):
"""
Start the XEP-0092 plugin.
"""
- self.name = self.config.get('name', 'SleekXMPP')
- self.version = self.config.get('version', sleekxmpp.__version__)
- self.os = self.config.get('os', '')
-
- self.getVersion = self.get_version
+ if 'name' in self.config:
+ self.software_name = self.config['name']
self.xmpp.register_handler(
Callback('Software Version',
@@ -63,12 +65,12 @@ class XEP_0092(BasePlugin):
iq -- The Iq stanza containing the software version query.
"""
iq.reply()
- iq['software_version']['name'] = self.name
+ iq['software_version']['name'] = self.software_name
iq['software_version']['version'] = self.version
iq['software_version']['os'] = self.os
iq.send()
- def get_version(self, jid, ifrom=None):
+ def get_version(self, jid, ifrom=None, block=True, timeout=None, callback=None):
"""
Retrieve the software version of a remote agent.
@@ -80,11 +82,4 @@ class XEP_0092(BasePlugin):
iq['from'] = ifrom
iq['type'] = 'get'
iq['query'] = Version.namespace
-
- result = iq.send()
-
- if result and result['type'] != 'error':
- values = result['software_version'].values
- del values['lang']
- return values
- return False
+ return iq.send(block=block, timeout=timeout, callback=callback)