diff options
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r-- | sleekxmpp/plugins/xep_0107/__init__.py | 7 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0107/user_mood.py | 23 |
2 files changed, 14 insertions, 16 deletions
diff --git a/sleekxmpp/plugins/xep_0107/__init__.py b/sleekxmpp/plugins/xep_0107/__init__.py index e1c5eacf..04302df8 100644 --- a/sleekxmpp/plugins/xep_0107/__init__.py +++ b/sleekxmpp/plugins/xep_0107/__init__.py @@ -6,6 +6,11 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin + from sleekxmpp.plugins.xep_0107 import stanza from sleekxmpp.plugins.xep_0107.stanza import UserMood -from sleekxmpp.plugins.xep_0107.user_mood import xep_0107 +from sleekxmpp.plugins.xep_0107.user_mood import XEP_0107 + + +register_plugin(XEP_0107) diff --git a/sleekxmpp/plugins/xep_0107/user_mood.py b/sleekxmpp/plugins/xep_0107/user_mood.py index 37749b4b..11aaace4 100644 --- a/sleekxmpp/plugins/xep_0107/user_mood.py +++ b/sleekxmpp/plugins/xep_0107/user_mood.py @@ -12,34 +12,27 @@ from sleekxmpp import Message 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_0107 import stanza, UserMood log = logging.getLogger(__name__) -class xep_0107(base_plugin): +class XEP_0107(BasePlugin): """ XEP-0107: User Mood """ - def plugin_init(self): - self.xep = '0107' - self.description = 'User Mood' - self.stanza = stanza - - def post_init(self): - base_plugin.post_init(self) + name = 'xep_0107' + description = 'XEP-0107: User Mood' + dependencies = set(['xep_0163']) + stanza = stanza - pubsub_stanza = self.xmpp['xep_0060'].stanza + def plugin_init(self): register_stanza_plugin(Message, UserMood) - register_stanza_plugin(pubsub_stanza.EventItem, UserMood) - - self.xmpp['xep_0030'].add_feature(UserMood.namespace) - self.xmpp['xep_0163'].add_interest(UserMood.namespace) - self.xmpp['xep_0060'].map_node_event(UserMood.namespace, 'user_mood') + self.xmpp['xep_0163'].register_pep('user_mood', UserMood) def publish_mood(self, value=None, text=None, options=None, ifrom=None, block=True, callback=None, timeout=None): |