summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0092/version.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-26 23:04:16 -0700
committerLance Stout <lancestout@gmail.com>2012-07-26 23:04:16 -0700
commita06fa2de677afad437622216fac7971b727ac569 (patch)
tree37e8774a4cf2515bd31685c801d873ce4ef87127 /sleekxmpp/plugins/xep_0092/version.py
parent35396d2977f9b19f6690b88a7c2f3c7f4f09356b (diff)
downloadslixmpp-a06fa2de677afad437622216fac7971b727ac569.tar.gz
slixmpp-a06fa2de677afad437622216fac7971b727ac569.tar.bz2
slixmpp-a06fa2de677afad437622216fac7971b727ac569.tar.xz
slixmpp-a06fa2de677afad437622216fac7971b727ac569.zip
Enhance plugin config with attribute accessors.
This makes updating the config after plugin initialization much easier.
Diffstat (limited to 'sleekxmpp/plugins/xep_0092/version.py')
-rw-r--r--sleekxmpp/plugins/xep_0092/version.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py
index 463da158..35813e1d 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,7 +65,7 @@ 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()
@@ -88,3 +90,6 @@ class XEP_0092(BasePlugin):
del values['lang']
return values
return False
+
+
+XEP_0092.getVersion = XEP_0092.get_version