diff options
author | Lance Stout <lancestout@gmail.com> | 2011-03-22 12:00:01 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-03-22 12:00:01 -0400 |
commit | e1360ae04946a4b6f9fe7ed19f9349ce24405dd1 (patch) | |
tree | 7f0ecd15d0b242b05d43bdc60aa064e399778f9e | |
parent | b048f8d733dd7121d820fa196b5de5c9a77adae2 (diff) | |
parent | 86a6b40fd81daa7d0e976dbc63f33544060c75d1 (diff) | |
download | slixmpp-e1360ae04946a4b6f9fe7ed19f9349ce24405dd1.tar.gz slixmpp-e1360ae04946a4b6f9fe7ed19f9349ce24405dd1.tar.bz2 slixmpp-e1360ae04946a4b6f9fe7ed19f9349ce24405dd1.tar.xz slixmpp-e1360ae04946a4b6f9fe7ed19f9349ce24405dd1.zip |
Merge branch 'develop' into roster
-rw-r--r-- | sleekxmpp/clientxmpp.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index 02e1b390..93277a8c 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. @@ -143,7 +143,9 @@ class ClientXMPP(BaseXMPP): Arguments: address -- A tuple containing the server's host and port. reattempt -- If True, reattempt the connection if an - error occurs. + error occurs. Defaults to True. + use_tls -- Indicates if TLS should be used for the + connection. Defaults to True. """ self.session_started_event.clear() if not address or len(address) < 2: @@ -188,7 +190,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 +270,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 +302,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") |