From 6497857495d185401426ba31441e3039fb316891 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 12 Mar 2012 00:22:42 -0700 Subject: Move XEP-0202 to new system. --- sleekxmpp/plugins/xep_0202/__init__.py | 10 +++++++++- sleekxmpp/plugins/xep_0202/time.py | 17 +++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sleekxmpp/plugins/xep_0202/__init__.py b/sleekxmpp/plugins/xep_0202/__init__.py index a34b2376..cdab3665 100644 --- a/sleekxmpp/plugins/xep_0202/__init__.py +++ b/sleekxmpp/plugins/xep_0202/__init__.py @@ -6,7 +6,15 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin from sleekxmpp.plugins.xep_0202 import stanza from sleekxmpp.plugins.xep_0202.stanza import EntityTime -from sleekxmpp.plugins.xep_0202.time import xep_0202 +from sleekxmpp.plugins.xep_0202.time import XEP_0202 + + +register_plugin(XEP_0202) + + +# Retain some backwards compatibility +xep_0202 = XEP_0202 diff --git a/sleekxmpp/plugins/xep_0202/time.py b/sleekxmpp/plugins/xep_0202/time.py index 2c6faa4b..ca388c5b 100644 --- a/sleekxmpp/plugins/xep_0202/time.py +++ b/sleekxmpp/plugins/xep_0202/time.py @@ -12,7 +12,7 @@ from sleekxmpp.stanza.iq import Iq from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.xmlstream.handler import Callback from sleekxmpp.xmlstream.matcher import StanzaPath -from sleekxmpp.plugins.base import base_plugin +from sleekxmpp.plugins import BasePlugin from sleekxmpp.plugins import xep_0082 from sleekxmpp.plugins.xep_0202 import stanza @@ -20,18 +20,19 @@ from sleekxmpp.plugins.xep_0202 import stanza log = logging.getLogger(__name__) -class xep_0202(base_plugin): +class XEP_0202(BasePlugin): """ XEP-0202: Entity Time """ + name = 'xep_0202' + description = 'XEP-0202: Entity Time' + dependencies = set(['xep_0030', 'xep_0082']) + stanza = stanza + def plugin_init(self): """Start the XEP-0203 plugin.""" - self.xep = '0202' - self.description = 'Entity Time' - self.stanza = stanza - self.tz_offset = self.config.get('tz_offset', 0) # As a default, respond to time requests with the @@ -48,12 +49,8 @@ class xep_0202(base_plugin): self._handle_time_request)) register_stanza_plugin(Iq, stanza.EntityTime) - def post_init(self): - """Handle cross-plugin interactions.""" - base_plugin.post_init(self) self.xmpp['xep_0030'].add_feature('urn:xmpp:time') - def _handle_time_request(self, iq): """ Respond to a request for the local time. -- cgit v1.2.3