summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-11 22:36:37 -0700
committerLance Stout <lancestout@gmail.com>2012-03-12 19:32:19 -0700
commit26ea67d211d0f70977de55f9f7af8a4d1d8b2819 (patch)
tree4f9181394ba57a7865a3cc666db3a0c0c8300296 /sleekxmpp
parentd43cd9fa540a87f68aaa76f48de27642fdc9764b (diff)
downloadslixmpp-26ea67d211d0f70977de55f9f7af8a4d1d8b2819.tar.gz
slixmpp-26ea67d211d0f70977de55f9f7af8a4d1d8b2819.tar.bz2
slixmpp-26ea67d211d0f70977de55f9f7af8a4d1d8b2819.tar.xz
slixmpp-26ea67d211d0f70977de55f9f7af8a4d1d8b2819.zip
Move XEP-0045 to new system.
Still needs updating to the new format.
Diffstat (limited to 'sleekxmpp')
-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)