From 0eb009496e4e2998f6387f835f8ae29830f1a61b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 27 Nov 2012 19:53:43 -0500 Subject: Use the username credential instead of jid to enable ANONYMOUS auth. --- sleekxmpp/features/feature_mechanisms/mechanisms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py index a6e43a76..9f3c47f6 100644 --- a/sleekxmpp/features/feature_mechanisms/mechanisms.py +++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py @@ -44,15 +44,16 @@ class FeatureMechanisms(BasePlugin): } def plugin_init(self): - if not self.use_mech and not self.xmpp.requested_jid.user: - self.use_mech = 'ANONYMOUS' - if self.sasl_callback is None: self.sasl_callback = self._default_credentials if self.security_callback is None: self.security_callback = self._default_security + creds = self.sasl_callback(set(['username']), set()) + if not self.use_mech and not creds['username']: + self.use_mech = 'ANONYMOUS' + self.mech = None self.mech_list = set() self.attempted_mechs = set() -- cgit v1.2.3