diff options
-rw-r--r-- | include/modules/sasl.h | 12 | ||||
-rw-r--r-- | src/modules/m_sasl.cpp | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/include/modules/sasl.h b/include/modules/sasl.h index 321711a68..0a7b19a70 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -19,13 +19,15 @@ #pragma once -class SASLFallback : public Event +#include "event.h" + +class SASLEventListener : public Events::ModuleEventListener { public: - const parameterlist& params; - SASLFallback(Module* me, const parameterlist& p) - : Event(me, "sasl_fallback"), params(p) + SASLEventListener(Module* mod) + : ModuleEventListener(mod, "event/sasl") { - Send(); } + + virtual void OnSASLAuth(const parameterlist& params) = 0; }; diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index ade998b4e..c96b87034 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -28,12 +28,13 @@ enum SaslState { SASL_INIT, SASL_COMM, SASL_DONE }; enum SaslResult { SASL_OK, SASL_FAIL, SASL_ABORT }; static std::string sasl_target = "*"; +static Events::ModuleEventProvider* saslevprov; static void SendSASL(const parameterlist& params) { if (!ServerInstance->PI->SendEncapsulatedData(sasl_target, "SASL", params)) { - SASLFallback(NULL, params); + FOREACH_MOD_CUSTOM(*saslevprov, SASLEventListener, OnSASLAuth, (params)); } } @@ -246,6 +247,7 @@ class ModuleSASL : public Module GenericCap cap; CommandAuthenticate auth; CommandSASL sasl; + Events::ModuleEventProvider sasleventprov; public: ModuleSASL() @@ -253,7 +255,9 @@ class ModuleSASL : public Module , cap(this, "sasl") , auth(this, authExt, cap) , sasl(this, authExt) + , sasleventprov(this, "event/sasl") { + saslevprov = &sasleventprov; } void init() CXX11_OVERRIDE |