summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-11 22:30:02 -0700
committerLance Stout <lancestout@gmail.com>2012-03-12 19:32:19 -0700
commit6f337b5425a358fe160608ac304644ce970dfb18 (patch)
treefadbc83d70a4136b3f2fbdb4b4c7a32bb0a2b5ea /sleekxmpp/plugins
parentd104a5fe75dfee29768542a395cdd6958b331ed8 (diff)
downloadslixmpp-6f337b5425a358fe160608ac304644ce970dfb18.tar.gz
slixmpp-6f337b5425a358fe160608ac304644ce970dfb18.tar.bz2
slixmpp-6f337b5425a358fe160608ac304644ce970dfb18.tar.xz
slixmpp-6f337b5425a358fe160608ac304644ce970dfb18.zip
Move XEP-0012 to new system.
Still needs to update to the current plugin format though.
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0012.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/sleekxmpp/plugins/xep_0012.py b/sleekxmpp/plugins/xep_0012.py
index c5532bd4..123181cf 100644
--- a/sleekxmpp/plugins/xep_0012.py
+++ b/sleekxmpp/plugins/xep_0012.py
@@ -9,11 +9,11 @@
from datetime import datetime
import logging
-from . import base
-from .. stanza.iq import Iq
-from .. xmlstream.handler.callback import Callback
-from .. xmlstream.matcher.xpath import MatchXPath
-from .. xmlstream import ElementBase, ET, JID, register_stanza_plugin
+from sleekxmpp.plugins import BasePlugin, register_plugin
+from sleekxmpp import Iq
+from sleekxmpp.xmlstream.handler.callback import Callback
+from sleekxmpp.xmlstream.matcher.xpath import MatchXPath
+from sleekxmpp.xmlstream import ElementBase, ET, JID, register_stanza_plugin
log = logging.getLogger(__name__)
@@ -40,12 +40,18 @@ class LastActivity(ElementBase):
def del_status(self):
self.xml.text = ''
-class xep_0012(base.base_plugin):
+
+class XEP_0012(BasePlugin):
+
"""
XEP-0012 Last Activity
"""
+
+ name = 'xep_0012'
+ description = 'XEP-0012: Last Activity'
+ dependencies = set(['xep_0030'])
+
def plugin_init(self):
- self.description = "Last Activity"
self.xep = "0012"
self.xmpp.registerHandler(
@@ -57,9 +63,6 @@ class xep_0012(base.base_plugin):
self.xmpp.add_event_handler('last_activity_request', self.handle_last_activity)
-
- def post_init(self):
- base.base_plugin.post_init(self)
if self.xmpp.is_component:
# We are a component, so we track the uptime
self.xmpp.add_event_handler("session_start", self._reset_uptime)
@@ -113,3 +116,6 @@ class xep_0012(base.base_plugin):
id = iq.get('id')
result = iq.send()
return result['last_activity']['seconds']
+
+
+register_plugin(XEP_0012)