summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-03-22 11:56:55 -0400
committerLance Stout <lancestout@gmail.com>2011-03-22 11:56:55 -0400
commit7ef6abb2a3bdac302942b71c17369d10773a0eaf (patch)
tree82bfb4b98a0e9524aa7e542de5822de66316f42a
parentdbf6780345bb202d4a0a49034fbfc4535e844170 (diff)
downloadslixmpp-7ef6abb2a3bdac302942b71c17369d10773a0eaf.tar.gz
slixmpp-7ef6abb2a3bdac302942b71c17369d10773a0eaf.tar.bz2
slixmpp-7ef6abb2a3bdac302942b71c17369d10773a0eaf.tar.xz
slixmpp-7ef6abb2a3bdac302942b71c17369d10773a0eaf.zip
May pass use_tls=False to connect().
Will disable the use of TLS for the session.
-rw-r--r--sleekxmpp/clientxmpp.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index 1e860eae..3e326fc4 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -132,7 +132,7 @@ class ClientXMPP(BaseXMPP):
log.debug("Session start has taken more than 15 seconds")
self.disconnect(reconnect=self.auto_reconnect)
- def connect(self, address=tuple(), reattempt=True):
+ def connect(self, address=tuple(), reattempt=True, use_tls=True):
"""
Connect to the XMPP server.
@@ -188,7 +188,7 @@ class ClientXMPP(BaseXMPP):
address = (self.boundjid.host, 5222)
return XMLStream.connect(self, address[0], address[1],
- use_tls=True, reattempt=reattempt)
+ use_tls=use_tls, reattempt=reattempt)
def register_feature(self, mask, pointer, breaker=False):
"""
@@ -268,7 +268,9 @@ class ClientXMPP(BaseXMPP):
Arguments:
xml -- The STARTLS proceed element.
"""
- if not self.authenticated and self.ssl_support:
+ if not self.use_tls:
+ return False
+ elif not self.authenticated and self.ssl_support:
tls_ns = 'urn:ietf:params:xml:ns:xmpp-tls'
self.add_handler("<proceed xmlns='%s' />" % tls_ns,
self._handle_tls_start,
@@ -298,7 +300,8 @@ class ClientXMPP(BaseXMPP):
Arguments:
xml -- The SASL mechanisms stanza.
"""
- if '{urn:ietf:params:xml:ns:xmpp-tls}starttls' in self.features:
+ if self.use_tls and \
+ '{urn:ietf:params:xml:ns:xmpp-tls}starttls' in self.features:
return False
log.debug("Starting SASL Auth")