Move XEP-0045 to new system.
Still needs updating to the new format.
This commit is contained in:
parent
d43cd9fa54
commit
26ea67d211
1 changed files with 20 additions and 11 deletions
|
@ -6,14 +6,15 @@
|
|||
See the file LICENSE for copying permission.
|
||||
"""
|
||||
from __future__ import with_statement
|
||||
from . import base
|
||||
|
||||
import logging
|
||||
from xml.etree import cElementTree as ET
|
||||
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, JID
|
||||
from .. stanza.presence import Presence
|
||||
from .. xmlstream.handler.callback import Callback
|
||||
from .. xmlstream.matcher.xpath import MatchXPath
|
||||
from .. xmlstream.matcher.xmlmask import MatchXMLMask
|
||||
|
||||
from sleekxmpp import Presence
|
||||
from sleekxmpp.plugins import BasePlugin, register_plugin
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin, ElementBase, JID, ET
|
||||
from sleekxmpp.xmlstream.handler.callback import Callback
|
||||
from sleekxmpp.xmlstream.matcher.xpath import MatchXPath
|
||||
from sleekxmpp.xmlstream.matcher.xmlmask import MatchXMLMask
|
||||
from sleekxmpp.exceptions import IqError, IqTimeout
|
||||
|
||||
|
||||
|
@ -107,18 +108,23 @@ class MUCPresence(ElementBase):
|
|||
log.warning("Cannot delete room through mucpresence plugin.")
|
||||
return self
|
||||
|
||||
class xep_0045(base.base_plugin):
|
||||
|
||||
class XEP_0045(BasePlugin):
|
||||
|
||||
"""
|
||||
Implements XEP-0045 Multi User Chat
|
||||
Implements XEP-0045 Multi-User Chat
|
||||
"""
|
||||
|
||||
name = 'xep_0045'
|
||||
description = 'XEP-0045: Multi-User Chat'
|
||||
dependencies = set(['xep_0030', 'xep_0004'])
|
||||
|
||||
def plugin_init(self):
|
||||
self.rooms = {}
|
||||
self.ourNicks = {}
|
||||
self.xep = '0045'
|
||||
self.description = 'Multi User Chat'
|
||||
# load MUC support in presence stanzas
|
||||
registerStanzaPlugin(Presence, MUCPresence)
|
||||
register_stanza_plugin(Presence, MUCPresence)
|
||||
self.xmpp.registerHandler(Callback('MUCPresence', MatchXMLMask("<presence xmlns='%s' />" % self.xmpp.default_ns), self.handle_groupchat_presence))
|
||||
self.xmpp.registerHandler(Callback('MUCMessage', MatchXMLMask("<message xmlns='%s' type='groupchat'><body/></message>" % self.xmpp.default_ns), self.handle_groupchat_message))
|
||||
self.xmpp.registerHandler(Callback('MUCSubject', MatchXMLMask("<message xmlns='%s' type='groupchat'><subject/></message>" % self.xmpp.default_ns), self.handle_groupchat_subject))
|
||||
|
@ -374,3 +380,6 @@ class xep_0045(base.base_plugin):
|
|||
if room not in self.rooms.keys():
|
||||
return None
|
||||
return self.rooms[room].keys()
|
||||
|
||||
|
||||
register_plugin(XEP_0045)
|
||||
|
|
Loading…
Reference in a new issue