Move XEP-0078 to new system.
This commit is contained in:
parent
26ea67d211
commit
23cc62fe7c
2 changed files with 16 additions and 8 deletions
|
@ -6,7 +6,15 @@
|
||||||
See the file LICENSE for copying permission.
|
See the file LICENSE for copying permission.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from sleekxmpp.plugins.base import register_plugin
|
||||||
|
|
||||||
from sleekxmpp.plugins.xep_0078 import stanza
|
from sleekxmpp.plugins.xep_0078 import stanza
|
||||||
from sleekxmpp.plugins.xep_0078.stanza import IqAuth, AuthFeature
|
from sleekxmpp.plugins.xep_0078.stanza import IqAuth, AuthFeature
|
||||||
from sleekxmpp.plugins.xep_0078.legacyauth import xep_0078
|
from sleekxmpp.plugins.xep_0078.legacyauth import XEP_0078
|
||||||
|
|
||||||
|
|
||||||
|
register_plugin(XEP_0078)
|
||||||
|
|
||||||
|
|
||||||
|
# Retain some backwards compatibility
|
||||||
|
xep_0078 = XEP_0078
|
||||||
|
|
|
@ -14,14 +14,14 @@ import sys
|
||||||
from sleekxmpp.exceptions import IqError, IqTimeout
|
from sleekxmpp.exceptions import IqError, IqTimeout
|
||||||
from sleekxmpp.stanza import Iq, StreamFeatures
|
from sleekxmpp.stanza import Iq, StreamFeatures
|
||||||
from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin
|
from sleekxmpp.xmlstream import ElementBase, ET, register_stanza_plugin
|
||||||
from sleekxmpp.plugins.base import base_plugin
|
from sleekxmpp.plugins import BasePlugin
|
||||||
from sleekxmpp.plugins.xep_0078 import stanza
|
from sleekxmpp.plugins.xep_0078 import stanza
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class xep_0078(base_plugin):
|
class XEP_0078(BasePlugin):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
XEP-0078 NON-SASL Authentication
|
XEP-0078 NON-SASL Authentication
|
||||||
|
@ -30,11 +30,12 @@ class xep_0078(base_plugin):
|
||||||
unless you are forced to use an old XMPP server implementation.
|
unless you are forced to use an old XMPP server implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def plugin_init(self):
|
name = 'xep_0078'
|
||||||
self.xep = "0078"
|
description = 'XEP-0078: Non-SASL Authentication'
|
||||||
self.description = "Non-SASL Authentication"
|
dependencies = set()
|
||||||
self.stanza = stanza
|
stanza = stanza
|
||||||
|
|
||||||
|
def plugin_init(self):
|
||||||
self.xmpp.register_feature('auth',
|
self.xmpp.register_feature('auth',
|
||||||
self._handle_auth,
|
self._handle_auth,
|
||||||
restart=False,
|
restart=False,
|
||||||
|
@ -43,7 +44,6 @@ class xep_0078(base_plugin):
|
||||||
register_stanza_plugin(Iq, stanza.IqAuth)
|
register_stanza_plugin(Iq, stanza.IqAuth)
|
||||||
register_stanza_plugin(StreamFeatures, stanza.AuthFeature)
|
register_stanza_plugin(StreamFeatures, stanza.AuthFeature)
|
||||||
|
|
||||||
|
|
||||||
def _handle_auth(self, features):
|
def _handle_auth(self, features):
|
||||||
# If we can or have already authenticated with SASL, do nothing.
|
# If we can or have already authenticated with SASL, do nothing.
|
||||||
if 'mechanisms' in features['features']:
|
if 'mechanisms' in features['features']:
|
||||||
|
|
Loading…
Reference in a new issue