Move XEP-0045 to new system.
Still needs updating to the new format.
This commit is contained in:
parent
d43cd9fa54
commit
26ea67d211
@ -6,14 +6,15 @@
|
|||||||
See the file LICENSE for copying permission.
|
See the file LICENSE for copying permission.
|
||||||
"""
|
"""
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
from . import base
|
|
||||||
import logging
|
import logging
|
||||||
from xml.etree import cElementTree as ET
|
|
||||||
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, JID
|
from sleekxmpp import Presence
|
||||||
from .. stanza.presence import Presence
|
from sleekxmpp.plugins import BasePlugin, register_plugin
|
||||||
from .. xmlstream.handler.callback import Callback
|
from sleekxmpp.xmlstream import register_stanza_plugin, ElementBase, JID, ET
|
||||||
from .. xmlstream.matcher.xpath import MatchXPath
|
from sleekxmpp.xmlstream.handler.callback import Callback
|
||||||
from .. xmlstream.matcher.xmlmask import MatchXMLMask
|
from sleekxmpp.xmlstream.matcher.xpath import MatchXPath
|
||||||
|
from sleekxmpp.xmlstream.matcher.xmlmask import MatchXMLMask
|
||||||
from sleekxmpp.exceptions import IqError, IqTimeout
|
from sleekxmpp.exceptions import IqError, IqTimeout
|
||||||
|
|
||||||
|
|
||||||
@ -107,18 +108,23 @@ class MUCPresence(ElementBase):
|
|||||||
log.warning("Cannot delete room through mucpresence plugin.")
|
log.warning("Cannot delete room through mucpresence plugin.")
|
||||||
return self
|
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):
|
def plugin_init(self):
|
||||||
self.rooms = {}
|
self.rooms = {}
|
||||||
self.ourNicks = {}
|
self.ourNicks = {}
|
||||||
self.xep = '0045'
|
self.xep = '0045'
|
||||||
self.description = 'Multi User Chat'
|
|
||||||
# load MUC support in presence stanzas
|
# 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('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('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))
|
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():
|
if room not in self.rooms.keys():
|
||||||
return None
|
return None
|
||||||
return self.rooms[room].keys()
|
return self.rooms[room].keys()
|
||||||
|
|
||||||
|
|
||||||
|
register_plugin(XEP_0045)
|
||||||
|
Loading…
Reference in New Issue
Block a user