Move XEP-0202 to new system.

This commit is contained in:
Lance Stout 2012-03-12 00:22:42 -07:00
parent 5a324c01de
commit 6497857495
2 changed files with 16 additions and 11 deletions

View file

@ -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

View file

@ -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.