Move XEP-0224 to new system.
This commit is contained in:
parent
4a009515c1
commit
87d6ade06d
2 changed files with 17 additions and 10 deletions
|
@ -6,6 +6,15 @@
|
||||||
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_0224 import stanza
|
from sleekxmpp.plugins.xep_0224 import stanza
|
||||||
from sleekxmpp.plugins.xep_0224.stanza import Attention
|
from sleekxmpp.plugins.xep_0224.stanza import Attention
|
||||||
from sleekxmpp.plugins.xep_0224.attention import xep_0224
|
from sleekxmpp.plugins.xep_0224.attention import XEP_0224
|
||||||
|
|
||||||
|
|
||||||
|
register_plugin(XEP_0224)
|
||||||
|
|
||||||
|
|
||||||
|
# Retain some backwards compatibility
|
||||||
|
xep_0224 = XEP_0224
|
||||||
|
|
|
@ -12,25 +12,26 @@ from sleekxmpp.stanza import Message
|
||||||
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.base import base_plugin
|
from sleekxmpp.plugins import BasePlugin
|
||||||
from sleekxmpp.plugins.xep_0224 import stanza
|
from sleekxmpp.plugins.xep_0224 import stanza
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class xep_0224(base_plugin):
|
class XEP_0224(BasePlugin):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
XEP-0224: Attention
|
XEP-0224: Attention
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
name = 'xep_0224'
|
||||||
|
description = 'XEP-0224: Attention'
|
||||||
|
dependencies = set(['xep_0030'])
|
||||||
|
stanza = stanza
|
||||||
|
|
||||||
def plugin_init(self):
|
def plugin_init(self):
|
||||||
"""Start the XEP-0224 plugin."""
|
"""Start the XEP-0224 plugin."""
|
||||||
self.xep = '0224'
|
|
||||||
self.description = 'Attention'
|
|
||||||
self.stanza = stanza
|
|
||||||
|
|
||||||
register_stanza_plugin(Message, stanza.Attention)
|
register_stanza_plugin(Message, stanza.Attention)
|
||||||
|
|
||||||
self.xmpp.register_handler(
|
self.xmpp.register_handler(
|
||||||
|
@ -38,9 +39,6 @@ class xep_0224(base_plugin):
|
||||||
StanzaPath('message/attention'),
|
StanzaPath('message/attention'),
|
||||||
self._handle_attention))
|
self._handle_attention))
|
||||||
|
|
||||||
def post_init(self):
|
|
||||||
"""Handle cross-plugin dependencies."""
|
|
||||||
base_plugin.post_init(self)
|
|
||||||
self.xmpp['xep_0030'].add_feature(stanza.Attention.namespace)
|
self.xmpp['xep_0030'].add_feature(stanza.Attention.namespace)
|
||||||
|
|
||||||
def request_attention(self, to, mfrom=None, mbody=''):
|
def request_attention(self, to, mfrom=None, mbody=''):
|
||||||
|
|
Loading…
Reference in a new issue