Move XEP-0108 to new system.

This commit is contained in:
Lance Stout 2012-03-12 19:18:03 -07:00
parent 14d4062f4a
commit a2b47e5749
2 changed files with 14 additions and 19 deletions

View file

@ -6,6 +6,11 @@
See the file LICENSE for copying permission.
"""
from sleekxmpp.plugins.base import register_plugin
from sleekxmpp.plugins.xep_0108 import stanza
from sleekxmpp.plugins.xep_0108.stanza import UserActivity
from sleekxmpp.plugins.xep_0108.user_activity import xep_0108
from sleekxmpp.plugins.xep_0108.user_activity import XEP_0108
register_plugin(XEP_0108)

View file

@ -8,36 +8,26 @@
import logging
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_0108 import stanza, UserActivity
log = logging.getLogger(__name__)
class xep_0108(base_plugin):
class XEP_0108(BasePlugin):
"""
XEP-0108: User Activity
"""
name = 'xep_0108'
description = 'XEP-0108: User Activity'
dependencies = set(['xep_0163'])
stanza = stanza
def plugin_init(self):
self.xep = '0108'
self.description = 'User Activity'
self.stanza = stanza
def post_init(self):
base_plugin.post_init(self)
pubsub_stanza = self.xmpp['xep_0060'].stanza
register_stanza_plugin(pubsub_stanza.EventItem, UserActivity)
self.xmpp['xep_0030'].add_feature(UserActivity.namespace)
self.xmpp['xep_0163'].add_interest(UserActivity.namespace)
self.xmpp['xep_0060'].map_node_event(UserActivity.namespace, 'user_activity')
self.xmpp['xep_0163'].register_pep('user_activity', UserActivity)
def publish_activity(self, general, specific=None, text=None, options=None,
ifrom=None, block=True, callback=None, timeout=None):