summaryrefslogtreecommitdiff
path: root/sleekxmpp/features/feature_bind
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/features/feature_bind')
-rw-r--r--sleekxmpp/features/feature_bind/__init__.py11
-rw-r--r--sleekxmpp/features/feature_bind/bind.py17
-rw-r--r--sleekxmpp/features/feature_bind/stanza.py3
3 files changed, 19 insertions, 12 deletions
diff --git a/sleekxmpp/features/feature_bind/__init__.py b/sleekxmpp/features/feature_bind/__init__.py
index aa854f87..9e0831dd 100644
--- a/sleekxmpp/features/feature_bind/__init__.py
+++ b/sleekxmpp/features/feature_bind/__init__.py
@@ -6,5 +6,14 @@
See the file LICENSE for copying permission.
"""
-from sleekxmpp.features.feature_bind.bind import feature_bind
+from sleekxmpp.plugins.base import register_plugin
+
+from sleekxmpp.features.feature_bind.bind import FeatureBind
from sleekxmpp.features.feature_bind.stanza import Bind
+
+
+register_plugin(FeatureBind)
+
+
+# Retain some backwards compatibility
+feature_bind = FeatureBind
diff --git a/sleekxmpp/features/feature_bind/bind.py b/sleekxmpp/features/feature_bind/bind.py
index d3b2b737..b828e26f 100644
--- a/sleekxmpp/features/feature_bind/bind.py
+++ b/sleekxmpp/features/feature_bind/bind.py
@@ -11,22 +11,20 @@ import logging
from sleekxmpp.stanza import Iq, StreamFeatures
from sleekxmpp.features.feature_bind import stanza
from sleekxmpp.xmlstream import register_stanza_plugin
-from sleekxmpp.xmlstream.matcher import *
-from sleekxmpp.xmlstream.handler import *
-from sleekxmpp.plugins.base import base_plugin
+from sleekxmpp.plugins import BasePlugin, register_plugin
log = logging.getLogger(__name__)
-class feature_bind(base_plugin):
+class FeatureBind(BasePlugin):
- def plugin_init(self):
- self.name = 'Bind Resource'
- self.rfc = '6120'
- self.description = 'Resource Binding Stream Feature'
- self.stanza = stanza
+ name = 'feature_bind'
+ description = 'RFC 6120: Stream Feature: Resource Binding'
+ dependencies = set()
+ stanza = stanza
+ def plugin_init(self):
self.xmpp.register_feature('bind',
self._handle_bind_resource,
restart=False,
@@ -52,6 +50,7 @@ class feature_bind(base_plugin):
self.xmpp.set_jid(response['bind']['jid'])
self.xmpp.bound = True
+ self.xmpp.event('session_bind', self.xmpp.boundjid, direct=True)
self.xmpp.features.add('bind')
diff --git a/sleekxmpp/features/feature_bind/stanza.py b/sleekxmpp/features/feature_bind/stanza.py
index 2c1484e0..8ce7536f 100644
--- a/sleekxmpp/features/feature_bind/stanza.py
+++ b/sleekxmpp/features/feature_bind/stanza.py
@@ -6,8 +6,7 @@
See the file LICENSE for copying permission.
"""
-from sleekxmpp.stanza import Iq, StreamFeatures
-from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin
+from sleekxmpp.xmlstream import ElementBase
class Bind(ElementBase):