mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
fba235a801
Moved SASL registration completely to the feature plugin, instead of keeping a portion of it in ClientXMPP.
31 lines
755 B
Python
31 lines
755 B
Python
import base64
|
|
import sys
|
|
import logging
|
|
|
|
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.stanza = self.xmpp['feature_mechanisms'].stanza
|
|
|
|
self.xmpp['feature_mechanisms'].register('ANONYMOUS',
|
|
self._handle_anonymous,
|
|
priority=self.config.get('priority', 0))
|
|
|
|
def _handle_anonymous(self):
|
|
if self.xmpp.boundjid.user:
|
|
return False
|
|
|
|
resp = self.stanza.Auth(self.xmpp)
|
|
resp['mechanism'] = 'ANONYMOUS'
|
|
resp.send(now=True)
|
|
|
|
return True
|