summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sleekxmpp/plugins/xep_0045.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py
index ab3f750a..8d694960 100644
--- a/sleekxmpp/plugins/xep_0045.py
+++ b/sleekxmpp/plugins/xep_0045.py
@@ -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)