Move XEP-0249 to the new system.

This commit is contained in:
Lance Stout 2012-03-12 00:36:48 -07:00
parent 87d6ade06d
commit 64c46562d3
2 changed files with 18 additions and 10 deletions

View file

@ -6,5 +6,14 @@
See the file LICENSE for copying permission. See the file LICENSE for copying permission.
""" """
from sleekxmpp.plugins.base import register_plugin
from sleekxmpp.plugins.xep_0249.stanza import Invite from sleekxmpp.plugins.xep_0249.stanza import Invite
from sleekxmpp.plugins.xep_0249.invite import xep_0249 from sleekxmpp.plugins.xep_0249.invite import XEP_0249
register_plugin(XEP_0249)
# Retain some backwards compatibility
xep_0249 = XEP_0249

View file

@ -10,27 +10,28 @@ import logging
import sleekxmpp import sleekxmpp
from sleekxmpp import Message from sleekxmpp import Message
from sleekxmpp.plugins.base import base_plugin from sleekxmpp.plugins import BasePlugin
from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream.handler import Callback from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import StanzaPath from sleekxmpp.xmlstream.matcher import StanzaPath
from sleekxmpp.plugins.xep_0249 import Invite from sleekxmpp.plugins.xep_0249 import Invite, stanza
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class xep_0249(base_plugin): class XEP_0249(BasePlugin):
""" """
XEP-0249: Direct MUC Invitations XEP-0249: Direct MUC Invitations
""" """
def plugin_init(self): name = 'xep_0249'
self.xep = "0249" description = 'XEP-0249: Direct MUC Invitations'
self.description = "Direct MUC Invitations" dependencies = set(['xep_0030'])
self.stanza = sleekxmpp.plugins.xep_0249.stanza stanza = stanza
def plugin_init(self):
self.xmpp.register_handler( self.xmpp.register_handler(
Callback('Direct MUC Invitations', Callback('Direct MUC Invitations',
StanzaPath('message/groupchat_invite'), StanzaPath('message/groupchat_invite'),
@ -38,8 +39,6 @@ class xep_0249(base_plugin):
register_stanza_plugin(Message, Invite) register_stanza_plugin(Message, Invite)
def post_init(self):
base_plugin.post_init(self)
self.xmpp['xep_0030'].add_feature(Invite.namespace) self.xmpp['xep_0030'].add_feature(Invite.namespace)
def _handle_invite(self, msg): def _handle_invite(self, msg):