summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sleekxmpp/plugins/xep_0172/__init__.py7
-rw-r--r--sleekxmpp/plugins/xep_0172/user_nick.py23
2 files changed, 14 insertions, 16 deletions
diff --git a/sleekxmpp/plugins/xep_0172/__init__.py b/sleekxmpp/plugins/xep_0172/__init__.py
index 24ae57e9..aa7b9f72 100644
--- a/sleekxmpp/plugins/xep_0172/__init__.py
+++ b/sleekxmpp/plugins/xep_0172/__init__.py
@@ -6,6 +6,11 @@
See the file LICENSE for copying permission.
"""
+from sleekxmpp.plugins.base import register_plugin
+
from sleekxmpp.plugins.xep_0172 import stanza
from sleekxmpp.plugins.xep_0172.stanza import UserNick
-from sleekxmpp.plugins.xep_0172.user_nick import xep_0172
+from sleekxmpp.plugins.xep_0172.user_nick import XEP_0172
+
+
+register_plugin(XEP_0172)
diff --git a/sleekxmpp/plugins/xep_0172/user_nick.py b/sleekxmpp/plugins/xep_0172/user_nick.py
index cd3c22f3..c20c3583 100644
--- a/sleekxmpp/plugins/xep_0172/user_nick.py
+++ b/sleekxmpp/plugins/xep_0172/user_nick.py
@@ -13,35 +13,28 @@ from sleekxmpp.stanza.presence import Presence
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import MatchXPath
-from sleekxmpp.plugins.base import base_plugin
+from sleekxmpp.plugins.base import BasePlugin
from sleekxmpp.plugins.xep_0172 import stanza, UserNick
log = logging.getLogger(__name__)
-class xep_0172(base_plugin):
+class XEP_0172(BasePlugin):
"""
XEP-0172: User Nickname
"""
- def plugin_init(self):
- self.xep = '0172'
- self.description = 'User Nickname'
- self.stanza = stanza
-
- def post_init(self):
- base_plugin.post_init(self)
+ name = 'xep_0172'
+ description = 'XEP-0172: User Nickname'
+ dependencies = set(['xep_0163'])
+ stanza = stanza
- pubsub_stanza = self.xmpp['xep_0060'].stanza
+ def plugin_init(self):
register_stanza_plugin(Message, UserNick)
register_stanza_plugin(Presence, UserNick)
- register_stanza_plugin(pubsub_stanza.EventItem, UserNick)
-
- self.xmpp['xep_0030'].add_feature(UserNick.namespace)
- self.xmpp['xep_0163'].add_interest(UserNick.namespace)
- self.xmpp['xep_0060'].map_node_event(UserNick.namespace, 'user_nick')
+ self.xmpp['xep_0163'].register_pep('user_nick', UserNick)
def publish_nick(self, nick=None, options=None, ifrom=None, block=True,
callback=None, timeout=None):