diff options
author | Lance Stout <lancestout@gmail.com> | 2011-09-28 22:48:30 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-09-28 22:48:30 -0400 |
commit | e37adace62ee7bb8a29f661ac33853d94456d35f (patch) | |
tree | 69bc8587c4cb8998c533a7665f7f580feb41db79 /sleekxmpp/clientxmpp.py | |
parent | d10f591bf4b84264df84d12e9d7ec380934c3887 (diff) | |
download | slixmpp-e37adace62ee7bb8a29f661ac33853d94456d35f.tar.gz slixmpp-e37adace62ee7bb8a29f661ac33853d94456d35f.tar.bz2 slixmpp-e37adace62ee7bb8a29f661ac33853d94456d35f.tar.xz slixmpp-e37adace62ee7bb8a29f661ac33853d94456d35f.zip |
Allow SASL mechanism to be set when creating a ClientXMPP instance.
Instead of using:
ClientXMPP(jid, password, plugin_config={
'feature_mechanisms': {'use_mech': 'SOME-MECH'}})
You can use:
ClientXMPP(jid, password, sasl_mech='SOME-MECH')
If you need to change the mechanism after instantiation, use:
xmpp['feature_mechanisms'].sasl.mech = 'SCRAM-MD5'
Diffstat (limited to 'sleekxmpp/clientxmpp.py')
-rw-r--r-- | sleekxmpp/clientxmpp.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index 2501f5d3..b7963a42 100644 --- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -59,7 +59,7 @@ class ClientXMPP(BaseXMPP): """ def __init__(self, jid, password, ssl=False, plugin_config={}, - plugin_whitelist=[], escape_quotes=True): + plugin_whitelist=[], escape_quotes=True, sasl_mech=None): """ Create a new SleekXMPP client. @@ -114,9 +114,10 @@ class ClientXMPP(BaseXMPP): # Setup default stream features self.register_plugin('feature_starttls') - self.register_plugin('feature_mechanisms') self.register_plugin('feature_bind') self.register_plugin('feature_session') + self.register_plugin('feature_mechanisms', + pconfig={'use_mech': sasl_mech} if sasl_mech else None) def connect(self, address=tuple(), reattempt=True, use_tls=True): """ |