summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0077/register.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0077/register.py')
-rw-r--r--sleekxmpp/plugins/xep_0077/register.py29
1 files changed, 12 insertions, 17 deletions
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