diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-11 22:15:25 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-03-12 19:32:19 -0700 |
commit | cdd69c68426c50bff9d11ee3380821e86196b1e2 (patch) | |
tree | f32c8f7ff0d30f68286a5ad6095c9afe1c508300 | |
parent | 4a3a9067d448b2fc328c4db53ff82c503517cf93 (diff) | |
download | slixmpp-cdd69c68426c50bff9d11ee3380821e86196b1e2.tar.gz slixmpp-cdd69c68426c50bff9d11ee3380821e86196b1e2.tar.bz2 slixmpp-cdd69c68426c50bff9d11ee3380821e86196b1e2.tar.xz slixmpp-cdd69c68426c50bff9d11ee3380821e86196b1e2.zip |
Move XEP-0077 to the new system.
-rw-r--r-- | sleekxmpp/plugins/xep_0066/oob.py | 2 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0077/__init__.py | 11 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0077/register.py | 29 |
3 files changed, 23 insertions, 19 deletions
diff --git a/sleekxmpp/plugins/xep_0066/oob.py b/sleekxmpp/plugins/xep_0066/oob.py index 6249e9b3..dc215e83 100644 --- a/sleekxmpp/plugins/xep_0066/oob.py +++ b/sleekxmpp/plugins/xep_0066/oob.py @@ -13,7 +13,7 @@ from sleekxmpp.exceptions import XMPPError from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.xmlstream.handler import Callback from sleekxmpp.xmlstream.matcher import StanzaPath -from sleekxmpp.plugins import BasePlugin, register_plugin +from sleekxmpp.plugins import BasePlugin from sleekxmpp.plugins.xep_0066 import stanza diff --git a/sleekxmpp/plugins/xep_0077/__init__.py b/sleekxmpp/plugins/xep_0077/__init__.py index e556aa93..779ae0ac 100644 --- a/sleekxmpp/plugins/xep_0077/__init__.py +++ b/sleekxmpp/plugins/xep_0077/__init__.py @@ -6,5 +6,14 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin + from sleekxmpp.plugins.xep_0077.stanza import Register, RegisterFeature -from sleekxmpp.plugins.xep_0077.register import xep_0077 +from sleekxmpp.plugins.xep_0077.register import XEP_0077 + + +register_plugin(XEP_0077) + + +# Retain some backwards compatibility +xep_0077 = XEP_0077 diff --git a/sleekxmpp/plugins/xep_0077/register.py b/sleekxmpp/plugins/xep_0077/register.py index 935ee71e..53cc9ef5 100644 --- a/sleekxmpp/plugins/xep_0077/register.py +++ b/sleekxmpp/plugins/xep_0077/register.py @@ -8,33 +8,32 @@ import logging -import sleekxmpp from sleekxmpp.stanza import StreamFeatures, Iq from sleekxmpp.xmlstream import register_stanza_plugin, JID -from sleekxmpp.plugins.base import base_plugin +from sleekxmpp.plugins import BasePlugin from sleekxmpp.plugins.xep_0077 import stanza, Register, RegisterFeature log = logging.getLogger(__name__) -class xep_0077(base_plugin): +class XEP_0077(BasePlugin): """ XEP-0077: In-Band Registration """ - def plugin_init(self): - self.xep = '0077' - self.description = 'In-Band Registration' - self.stanza = stanza + name = 'xep_0077' + description = 'XEP-0077: In-Band Registration' + dependencies = set(['xep_0004', 'xep_0066']) + stanza = stanza + def plugin_init(self): self.create_account = self.config.get('create_account', True) register_stanza_plugin(StreamFeatures, RegisterFeature) register_stanza_plugin(Iq, Register) - if self.xmpp.is_component: pass else: @@ -43,13 +42,8 @@ class xep_0077(base_plugin): restart=False, order=self.config.get('order', 50)) - def post_init(self): - base_plugin.post_init(self) - if 'xep_0004' in self.xmpp.plugin: - register_stanza_plugin(Register, self.xmpp['xep_0004'].stanza.Form) - - if 'xep_0066' in self.xmpp.plugin: - register_stanza_plugin(Register, self.xmpp['xep_0066'].stanza.OOB) + register_stanza_plugin(Register, self.xmpp['xep_0004'].stanza.Form) + register_stanza_plugin(Register, self.xmpp['xep_0066'].stanza.OOB) def _handle_register_feature(self, features): if 'mechanisms' in self.xmpp.features: @@ -69,7 +63,8 @@ class xep_0077(base_plugin): iq['to'] = jid iq['from'] = ifrom iq.enable('register') - return iq.send(block=block, timeout=timeout, callback=callback, now=True) + return iq.send(block=block, timeout=timeout, + callback=callback, now=True) def cancel_registration(self, jid=None, ifrom=None, block=True, timeout=None, callback=None): @@ -82,7 +77,7 @@ class xep_0077(base_plugin): def change_password(self, password, jid=None, ifrom=None, block=True, timeout=None, callback=None): - iq= self.xmpp.Iq() + iq = self.xmpp.Iq() iq['type'] = 'set' iq['to'] = jid iq['from'] = ifrom |