From 6c8a135612e1bc9a8da9347cdf1ae6c3858799c3 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 4 Aug 2011 21:49:15 -0700 Subject: Fix imports using __all__. --- sleekxmpp/features/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sleekxmpp/features') diff --git a/sleekxmpp/features/__init__.py b/sleekxmpp/features/__init__.py index 5c86cfea..5bfe173d 100644 --- a/sleekxmpp/features/__init__.py +++ b/sleekxmpp/features/__init__.py @@ -6,6 +6,4 @@ See the file LICENSE for copying permission. """ -__all__ = ['feature_starttls', 'feature_mechanisms', - 'feature_bind', 'feature_session', - 'sasl_plain', 'sasl_anonymous'] +__all__ = ['feature_starttls', 'feature_mechanisms', 'feature_bind'] -- cgit v1.2.3 From 47bc50d9fbbe8d72b589a6360aa8b5f32d6ba74b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 4 Aug 2011 22:37:22 -0700 Subject: Cosmetic PEP8 fixes. --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 1 - sleekxmpp/features/feature_mechanisms/stanza/mechanisms.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'sleekxmpp/features') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index d60818bb..2debf3be 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -29,7 +29,6 @@ class feature_mechanisms(base_plugin): self.description = "SASL Stream Feature" self.stanza = stanza - def tls_active(): return 'starttls' in self.xmpp.features diff --git a/sleekxmpp/features/feature_mechanisms/stanza/mechanisms.py b/sleekxmpp/features/feature_mechanisms/stanza/mechanisms.py index 1189cd80..c09cafbd 100644 --- a/sleekxmpp/features/feature_mechanisms/stanza/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/stanza/mechanisms.py @@ -42,9 +42,9 @@ class Mechanisms(ElementBase): """ self.del_mechanisms() for val in values: - mech = ET.Element('{%s}mechanism' % self.namespace) - mech.text = val - self.append(mech) + mech = ET.Element('{%s}mechanism' % self.namespace) + mech.text = val + self.append(mech) def del_mechanisms(self): """ -- cgit v1.2.3 From 572becad44b8cb577a1f8357e04fa93235894536 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 9 Aug 2011 00:51:49 -0700 Subject: Enable forcing a specififc SASL mech: xmpp = ClientXMPP(jid, password, { 'feature_mechanisms': {'use_mech':'PLAIN'}}) --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sleekxmpp/features') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index 2debf3be..a6cff0a0 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -29,6 +29,8 @@ class feature_mechanisms(base_plugin): self.description = "SASL Stream Feature" self.stanza = stanza + self.use_mech = self.config.get('use_mech', None) + def tls_active(): return 'starttls' in self.xmpp.features @@ -48,7 +50,8 @@ class feature_mechanisms(base_plugin): username=self.xmpp.boundjid.user, sec_query=suelta.sec_query_allow, request_values=sasl_callback, - tls_active=tls_active) + tls_active=tls_active, + mech=self.use_mech) register_stanza_plugin(StreamFeatures, stanza.Mechanisms) -- cgit v1.2.3