diff options
author | Daniel Vassdal <shutter@canternet.org> | 2014-02-14 15:03:42 -0800 |
---|---|---|
committer | Daniel Vassdal <shutter@canternet.org> | 2014-02-14 15:03:42 -0800 |
commit | b13bded620b391ecd613d3f4a1b759959ce6ae87 (patch) | |
tree | a319eb9251ff5dd2f33eb666c73f838655dd19a7 /include/modules/sasl.h | |
parent | 1b1180fda622b9f8a39555724fed0f45df0dc45e (diff) |
sasl.h, m_sasl.cpp: Move IdentifyRequest to the header
Diffstat (limited to 'include/modules/sasl.h')
-rw-r--r-- | include/modules/sasl.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/modules/sasl.h b/include/modules/sasl.h index f997ead76..a7c440110 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -72,4 +72,44 @@ namespace SASL sasl->DeleteSessions(this, true); } }; + + class IdentifyRequest : public ::IdentifyRequest + { + Anope::string uid; + + public: + IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass) : ::IdentifyRequest(m, acc, pass), uid(id) { } + + void OnSuccess() anope_override + { + if (!sasl) + return; + + NickAlias *na = NickAlias::Find(GetAccount()); + if (!na) + return OnFail(); + + Session *s = sasl->GetSession(uid); + if (s) + { + sasl->Succeed(s, na->nc); + delete s; + } + } + + void OnFail() anope_override + { + if (!sasl) + return; + + Session *s = sasl->GetSession(uid); + if (s) + { + sasl->Fail(s); + delete s; + } + + Log(Config->GetClient("NickServ")) << "A user failed to identify for account " << this->GetAccount() << " using SASL"; + } + }; } |