summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0092
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-07-17 14:19:04 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-07-17 14:19:04 +0200
commit5ab77c745270d7d5c016c1dc7ef2a82533a4b16e (patch)
tree259377cc666f8b9c7954fc4e7b8f7a912bcfe101 /sleekxmpp/plugins/xep_0092
parente5582694c07236e6830c20361840360a1dde37f3 (diff)
downloadslixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.gz
slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.bz2
slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.tar.xz
slixmpp-5ab77c745270d7d5c016c1dc7ef2a82533a4b16e.zip
Rename to slixmpp
Diffstat (limited to 'sleekxmpp/plugins/xep_0092')
-rw-r--r--sleekxmpp/plugins/xep_0092/__init__.py20
-rw-r--r--sleekxmpp/plugins/xep_0092/stanza.py42
-rw-r--r--sleekxmpp/plugins/xep_0092/version.py85
3 files changed, 0 insertions, 147 deletions
diff --git a/sleekxmpp/plugins/xep_0092/__init__.py b/sleekxmpp/plugins/xep_0092/__init__.py
deleted file mode 100644
index 293eaae6..00000000
--- a/sleekxmpp/plugins/xep_0092/__init__.py
+++ /dev/null
@@ -1,20 +0,0 @@
-"""
- SleekXMPP: The Sleek XMPP Library
- Copyright (C) 2010 Nathanael C. Fritz, Lance J.T. Stout
- This file is part of SleekXMPP.
-
- See the file LICENSE for copying permission.
-"""
-
-from sleekxmpp.plugins.base import register_plugin
-
-from sleekxmpp.plugins.xep_0092 import stanza
-from sleekxmpp.plugins.xep_0092.stanza import Version
-from sleekxmpp.plugins.xep_0092.version import XEP_0092
-
-
-register_plugin(XEP_0092)
-
-
-# Retain some backwards compatibility
-xep_0092 = XEP_0092
diff --git a/sleekxmpp/plugins/xep_0092/stanza.py b/sleekxmpp/plugins/xep_0092/stanza.py
deleted file mode 100644
index 77654e37..00000000
--- a/sleekxmpp/plugins/xep_0092/stanza.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""
- SleekXMPP: The Sleek XMPP Library
- Copyright (C) 2010 Nathanael C. Fritz
- This file is part of SleekXMPP.
-
- See the file LICENSE for copying permission.
-"""
-
-from sleekxmpp.xmlstream import ElementBase, ET
-
-
-class Version(ElementBase):
-
- """
- XMPP allows for an agent to advertise the name and version of the
- underlying software libraries, as well as the operating system
- that the agent is running on.
-
- Example version stanzas:
- <iq type="get">
- <query xmlns="jabber:iq:version" />
- </iq>
-
- <iq type="result">
- <query xmlns="jabber:iq:version">
- <name>SleekXMPP</name>
- <version>1.0</version>
- <os>Linux</os>
- </query>
- </iq>
-
- Stanza Interface:
- name -- The human readable name of the software.
- version -- The specific version of the software.
- os -- The name of the operating system running the program.
- """
-
- name = 'query'
- namespace = 'jabber:iq:version'
- plugin_attrib = 'software_version'
- interfaces = set(('name', 'version', 'os'))
- sub_interfaces = interfaces
diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py
deleted file mode 100644
index b16ad516..00000000
--- a/sleekxmpp/plugins/xep_0092/version.py
+++ /dev/null
@@ -1,85 +0,0 @@
-"""
- SleekXMPP: The Sleek XMPP Library
- Copyright (C) 2010 Nathanael C. Fritz
- This file is part of SleekXMPP.
-
- See the file LICENSE for copying permission.
-"""
-
-import logging
-
-import sleekxmpp
-from sleekxmpp import Iq
-from sleekxmpp.xmlstream import register_stanza_plugin
-from sleekxmpp.xmlstream.handler import Callback
-from sleekxmpp.xmlstream.matcher import StanzaPath
-from sleekxmpp.plugins import BasePlugin
-from sleekxmpp.plugins.xep_0092 import Version, stanza
-
-
-log = logging.getLogger(__name__)
-
-
-class XEP_0092(BasePlugin):
-
- """
- XEP-0092: Software Version
- """
-
- name = 'xep_0092'
- 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.
- """
- if 'name' in self.config:
- self.software_name = self.config['name']
-
- self.xmpp.register_handler(
- Callback('Software Version',
- StanzaPath('iq@type=get/software_version'),
- self._handle_version))
-
- register_stanza_plugin(Iq, Version)
-
- def plugin_end(self):
- self.xmpp.remove_handler('Software Version')
- self.xmpp['xep_0030'].del_feature(feature='jabber:iq:version')
-
- def session_bind(self, jid):
- self.xmpp.plugin['xep_0030'].add_feature('jabber:iq:version')
-
- def _handle_version(self, iq):
- """
- Respond to a software version query.
-
- Arguments:
- iq -- The Iq stanza containing the software version query.
- """
- iq.reply()
- 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, block=True, timeout=None, callback=None):
- """
- Retrieve the software version of a remote agent.
-
- Arguments:
- jid -- The JID of the entity to query.
- """
- iq = self.xmpp.Iq()
- iq['to'] = jid
- iq['from'] = ifrom
- iq['type'] = 'get'
- iq['query'] = Version.namespace
- return iq.send(block=block, timeout=timeout, callback=callback)