summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0066/oob.py2
-rw-r--r--sleekxmpp/plugins/xep_0077/__init__.py11
-rw-r--r--sleekxmpp/plugins/xep_0077/register.py29
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