diff options
author | Lance Stout <lancestout@gmail.com> | 2011-06-30 15:40:22 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-06-30 15:40:22 -0700 |
commit | 754ac5092a3a37819a71f6565a1e54b3f2547940 (patch) | |
tree | 8eac47a45f53e7f5bca0ffe312409dbb71924e42 /sleekxmpp/features/sasl_anonymous.py | |
parent | 9ed972ffeba8f5071d5cae8497322764207fec04 (diff) | |
download | slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.gz slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.bz2 slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.xz slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.zip |
Reorganize features into plugins.
Diffstat (limited to 'sleekxmpp/features/sasl_anonymous.py')
-rw-r--r-- | sleekxmpp/features/sasl_anonymous.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sleekxmpp/features/sasl_anonymous.py b/sleekxmpp/features/sasl_anonymous.py new file mode 100644 index 00000000..469d9d19 --- /dev/null +++ b/sleekxmpp/features/sasl_anonymous.py @@ -0,0 +1,31 @@ +import base64 +import sys +import logging + +from sleekxmpp.stanza.stream import sasl +from sleekxmpp.plugins.base import base_plugin + + +log = logging.getLogger(__name__) + + +class sasl_anonymous(base_plugin): + + def plugin_init(self): + self.name = 'SASL ANONYMOUS' + self.rfc = '6120' + self.description = 'SASL ANONYMOUS Mechanism' + + self.xmpp.register_sasl_mechanism('ANONYMOUS', + self._handle_anonymous, + priority=self.config.get('priority', 0)) + + def _handle_anonymous(self): + if self.xmpp.boundjid.user: + return False + + resp = sasl.Auth(self.xmpp) + resp['mechanism'] = 'ANONYMOUS' + resp.send(now=True) + + return True |