summaryrefslogtreecommitdiff
path: root/sleekxmpp/features/feature_mechanisms/mechanisms.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-11-27 19:53:43 -0500
committerLance Stout <lancestout@gmail.com>2012-11-27 19:53:43 -0500
commit0eb009496e4e2998f6387f835f8ae29830f1a61b (patch)
tree34520128c6897e0962392b2bb59dddaa2a1542b9 /sleekxmpp/features/feature_mechanisms/mechanisms.py
parent2c2498b65846397ce708452ff45f81ecc25b502f (diff)
downloadslixmpp-0eb009496e4e2998f6387f835f8ae29830f1a61b.tar.gz
slixmpp-0eb009496e4e2998f6387f835f8ae29830f1a61b.tar.bz2
slixmpp-0eb009496e4e2998f6387f835f8ae29830f1a61b.tar.xz
slixmpp-0eb009496e4e2998f6387f835f8ae29830f1a61b.zip
Use the username credential instead of jid to enable ANONYMOUS auth.
Diffstat (limited to 'sleekxmpp/features/feature_mechanisms/mechanisms.py')
-rw-r--r--sleekxmpp/features/feature_mechanisms/mechanisms.py7
1 files changed, 4 insertions, 3 deletions
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()