summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorfritzy <fritzy@ip-10-251-242-239.ec2.internal>2010-09-02 20:01:28 +0000
committerfritzy <fritzy@ip-10-251-242-239.ec2.internal>2010-09-02 20:01:28 +0000
commitd576e32f7aa28332848cdd6e39893266eded64fd (patch)
treee36a1b85dc0692b6be223f2259c3c2df9cdb5e53 /sleekxmpp/xmlstream/xmlstream.py
parent6dfea828be54d9048779d06b4b31be98b58a2343 (diff)
parent4a2e7c5393da945359edc2648a2ec124481acf7d (diff)
downloadslixmpp-d576e32f7aa28332848cdd6e39893266eded64fd.tar.gz
slixmpp-d576e32f7aa28332848cdd6e39893266eded64fd.tar.bz2
slixmpp-d576e32f7aa28332848cdd6e39893266eded64fd.tar.xz
slixmpp-d576e32f7aa28332848cdd6e39893266eded64fd.zip
Merge branch 'develop' of git@github.com:fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index bf39bb33..28aee2b4 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -139,8 +139,7 @@ class XMLStream(object):
self.socket = ssl.wrap_socket(self.socket, ssl_version=ssl.PROTOCOL_TLSv1, do_handshake_on_connect=False)
self.socket.do_handshake()
if sys.version_info < (3,0):
- from . filesocket import filesocket
- self.filesocket = filesocket(self.socket)
+ self.filesocket = filesocket.FileSocket(self.socket)
else:
self.filesocket = self.socket.makefile('rb', 0)
return True
@@ -358,8 +357,10 @@ class XMLStream(object):
return False
def registerHandler(self, handler, before=None, after=None):
- "Add handler with matcher class and parameters."
- self.__handlers.append(handler)
+ "Add handler with matcher class and parameters."
+ if handler.stream is None:
+ self.__handlers.append(handler)
+ handler.stream = self
def removeHandler(self, name):
"Removes the handler."
@@ -367,8 +368,10 @@ class XMLStream(object):
for handler in self.__handlers:
if handler.name == name:
self.__handlers.pop(idx)
- return
+ return True
idx += 1
+ return False
+
def registerStanza(self, stanza_class):
"Adds stanza. If root stanzas build stanzas sent in events while non-root stanzas build substanza objects."