Allow XEP 0092 to send os information

Doesn't send these information by default, only if provided in the
config dict (as the 'os' key)
This commit is contained in:
Florent Le Coz 2011-01-09 09:52:54 +08:00 committed by Lance Stout
parent 7c7fa0f008
commit 68ce47c905

View file

@ -18,6 +18,7 @@ class xep_0092(base.base_plugin):
self.xep = "0092" self.xep = "0092"
self.name = self.config.get('name', 'SleekXMPP') self.name = self.config.get('name', 'SleekXMPP')
self.version = self.config.get('version', '0.1-dev') self.version = self.config.get('version', '0.1-dev')
self.os = self.config.get('os', '')
self.xmpp.add_handler("<iq type='get' xmlns='%s'><query xmlns='jabber:iq:version' /></iq>" % self.xmpp.default_ns, self.report_version, name='Sofware Version') self.xmpp.add_handler("<iq type='get' xmlns='%s'><query xmlns='jabber:iq:version' /></iq>" % self.xmpp.default_ns, self.report_version, name='Sofware Version')
def post_init(self): def post_init(self):
@ -32,6 +33,10 @@ class xep_0092(base.base_plugin):
name.text = self.name name.text = self.name
version = ET.Element('version') version = ET.Element('version')
version.text = self.version version.text = self.version
if self.os:
os = ET.Element('os')
os.text = self.os
query.append(os)
query.append(name) query.append(name)
query.append(version) query.append(version)
iq.append(query) iq.append(query)