summaryrefslogtreecommitdiff
path: root/sleekxmpp/componentxmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-01 22:24:19 -0400
committerLance Stout <lancestout@gmail.com>2010-10-01 23:56:46 -0400
commit9f0baec7b2f531ec4c81059715c7dd622ffcd0ae (patch)
tree1aea3cfc74cdd7cac14d6760f9eda4d392458e84 /sleekxmpp/componentxmpp.py
parent433c1476270973812dad0ba89911630bd1df2ea1 (diff)
downloadslixmpp-9f0baec7b2f531ec4c81059715c7dd622ffcd0ae.tar.gz
slixmpp-9f0baec7b2f531ec4c81059715c7dd622ffcd0ae.tar.bz2
slixmpp-9f0baec7b2f531ec4c81059715c7dd622ffcd0ae.tar.xz
slixmpp-9f0baec7b2f531ec4c81059715c7dd622ffcd0ae.zip
Made first pass at cleaning BaseXMPP.
Have not intregrated the new JID class yet.
Diffstat (limited to 'sleekxmpp/componentxmpp.py')
-rwxr-xr-xsleekxmpp/componentxmpp.py25
1 files changed, 7 insertions, 18 deletions
diff --git a/sleekxmpp/componentxmpp.py b/sleekxmpp/componentxmpp.py
index 5534a457..00e52528 100755
--- a/sleekxmpp/componentxmpp.py
+++ b/sleekxmpp/componentxmpp.py
@@ -8,7 +8,7 @@
See the file LICENSE for copying permission.
"""
from __future__ import absolute_import
-from . basexmpp import basexmpp
+from . basexmpp import BaseXMPP
from xml.etree import cElementTree as ET
from . xmlstream.xmlstream import XMLStream
@@ -39,12 +39,11 @@ class ComponentXMPP(basexmpp, XMLStream):
"""SleekXMPP's client class. Use only for good, not evil."""
def __init__(self, jid, secret, host, port, plugin_config = {}, plugin_whitelist=[], use_jc_ns=False):
- XMLStream.__init__(self)
if use_jc_ns:
- self.default_ns = 'jabber:client'
+ default_ns = 'jabber:client'
else:
- self.default_ns = 'jabber:component:accept'
- basexmpp.__init__(self)
+ default_ns = 'jabber:component:accept'
+ BaseXMPP.__init__(self, default_ns)
self.auto_authorize = None
self.stream_header = "<stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' to='%s'>" % jid
self.stream_footer = "</stream:stream>"
@@ -54,17 +53,7 @@ class ComponentXMPP(basexmpp, XMLStream):
self.secret = secret
self.is_component = True
self.registerHandler(Callback('Handshake', MatchXPath('{jabber:component:accept}handshake'), self._handleHandshake))
-
- def __getitem__(self, key):
- if key in self.plugin:
- return self.plugin[key]
- else:
- logging.warning("""Plugin "%s" is not loaded.""" % key)
- return False
-
- def get(self, key, default):
- return self.plugin.get(key, default)
-
+
def incoming_filter(self, xmlobj):
if xmlobj.tag.startswith('{jabber:client}'):
xmlobj.tag = xmlobj.tag.replace('jabber:client', self.default_ns)
@@ -80,10 +69,10 @@ class ComponentXMPP(basexmpp, XMLStream):
else:
handshake.text = hashlib.sha1(bytes("%s%s" % (sid, self.secret), 'utf-8')).hexdigest().lower()
self.sendXML(handshake)
-
+
def _handleHandshake(self, xml):
self.event("session_start")
-
+
def connect(self):
logging.debug("Connecting to %s:%s" % (self.server_host, self.server_port))
return xmlstreammod.XMLStream.connect(self, self.server_host, self.server_port)