Finish cleaning up stream feature organization.

Fixed missing references that weren't caught due to leftover pyc
file allowing tests to keep working when they shouldn't have.
This commit is contained in:
Lance Stout 2011-07-02 21:43:02 -07:00
parent 04def6d925
commit b0297af38d
4 changed files with 9 additions and 11 deletions

View file

@ -21,7 +21,6 @@ from sleekxmpp import stanza
from sleekxmpp import features from sleekxmpp import features
from sleekxmpp.basexmpp import BaseXMPP from sleekxmpp.basexmpp import BaseXMPP
from sleekxmpp.stanza import * from sleekxmpp.stanza import *
from sleekxmpp.stanza.stream import tls, sasl
from sleekxmpp.xmlstream import XMLStream, RestartStream from sleekxmpp.xmlstream import XMLStream, RestartStream
from sleekxmpp.xmlstream import StanzaBase, ET, register_stanza_plugin from sleekxmpp.xmlstream import StanzaBase, ET, register_stanza_plugin
from sleekxmpp.xmlstream.matcher import * from sleekxmpp.xmlstream.matcher import *

View file

@ -8,11 +8,11 @@
import logging import logging
from sleekxmpp.stanza import stream
from sleekxmpp.xmlstream import RestartStream from sleekxmpp.xmlstream import RestartStream
from sleekxmpp.xmlstream.matcher import * from sleekxmpp.xmlstream.matcher import *
from sleekxmpp.xmlstream.handler import * from sleekxmpp.xmlstream.handler import *
from sleekxmpp.plugins.base import base_plugin from sleekxmpp.plugins.base import base_plugin
from sleekxmpp.features.feature_mechanisms import stanza
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -24,23 +24,24 @@ class feature_mechanisms(base_plugin):
self.name = 'SASL Mechanisms' self.name = 'SASL Mechanisms'
self.rfc = '6120' self.rfc = '6120'
self.description = "SASL Stream Feature" self.description = "SASL Stream Feature"
self.stanza = stanza
self.xmpp.register_stanza(stream.sasl.Success) self.xmpp.register_stanza(stanza.Success)
self.xmpp.register_stanza(stream.sasl.Failure) self.xmpp.register_stanza(stanza.Failure)
self.xmpp.register_stanza(stream.sasl.Auth) self.xmpp.register_stanza(stanza.Auth)
self._mechanism_handlers = {} self._mechanism_handlers = {}
self._mechanism_priorities = [] self._mechanism_priorities = []
self.xmpp.register_handler( self.xmpp.register_handler(
Callback('SASL Success', Callback('SASL Success',
MatchXPath(stream.sasl.Success.tag_name()), MatchXPath(stanza.Success.tag_name()),
self._handle_success, self._handle_success,
instream=True, instream=True,
once=True)) once=True))
self.xmpp.register_handler( self.xmpp.register_handler(
Callback('SASL Failure', Callback('SASL Failure',
MatchXPath(stream.sasl.Failure.tag_name()), MatchXPath(stanza.Failure.tag_name()),
self._handle_fail, self._handle_fail,
instream=True, instream=True,
once=True)) once=True))

View file

@ -2,7 +2,6 @@ import base64
import sys import sys
import logging import logging
from sleekxmpp.stanza.stream import sasl
from sleekxmpp.plugins.base import base_plugin from sleekxmpp.plugins.base import base_plugin
@ -24,7 +23,7 @@ class sasl_anonymous(base_plugin):
if self.xmpp.boundjid.user: if self.xmpp.boundjid.user:
return False return False
resp = sasl.Auth(self.xmpp) resp = self.xmpp['feature_sasl'].stanza.Auth(self.xmpp)
resp['mechanism'] = 'ANONYMOUS' resp['mechanism'] = 'ANONYMOUS'
resp.send(now=True) resp.send(now=True)

View file

@ -2,7 +2,6 @@ import base64
import sys import sys
import logging import logging
from sleekxmpp.stanza.stream import sasl
from sleekxmpp.plugins.base import base_plugin from sleekxmpp.plugins.base import base_plugin
@ -34,7 +33,7 @@ class sasl_plain(base_plugin):
auth = base64.b64encode(b'\x00' + user + \ auth = base64.b64encode(b'\x00' + user + \
b'\x00' + password).decode('utf-8') b'\x00' + password).decode('utf-8')
resp = sasl.Auth(self.xmpp) resp = self.xmpp['feature_mechanisms'].stanza.Auth(self.xmpp)
resp['mechanism'] = 'PLAIN' resp['mechanism'] = 'PLAIN'
resp['value'] = auth resp['value'] = auth
resp.send(now=True) resp.send(now=True)