From f0e1fc5aadcde96a8c8e776c77dd80e91368d216 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 14 Aug 2012 11:06:36 -0700 Subject: [PATCH] Fix using PLAIN over older SSL method. --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index dae2f59f..c5b4c754 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -7,6 +7,7 @@ """ import sys +import ssl import logging from sleekxmpp.util import sasl @@ -120,7 +121,12 @@ class FeatureMechanisms(BasePlugin): result = {} for value in values: if value == 'encrypted': - result[value] = 'starttls' in self.xmpp.features + if 'starttls' in self.xmpp.features: + result[value] = True + elif isinstance(self.xmpp.socket, ssl.SSLSocket): + result[value] = True + else: + result[value] = False else: result[value] = self.config.get(value, False) return result