From b8b63ff115f0daddf479b0da507a2f731255a06d Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 7 Oct 2012 22:39:58 -0400 Subject: Remove the asynchronous identifing hack and replace it with something better. Fixes m_*_authentication only being able to properly work when people identify normally using nickserv/identify --- include/account.h | 32 ++++++++++++++++++++++++++++++++ include/defs.h | 1 + include/modules.h | 12 ++++-------- 3 files changed, 37 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/account.h b/include/account.h index 8b4920fe4..7aecab43a 100644 --- a/include/account.h +++ b/include/account.h @@ -304,7 +304,39 @@ class CoreExport NickCore : public Extensible, public Flags holds; + bool dispatched; + bool success; + + static std::set requests; + + protected: + IdentifyRequest(const Anope::string &acc, const Anope::string &pass); + virtual ~IdentifyRequest(); + + public: + virtual void OnSuccess() = 0; + virtual void OnFail() = 0; + + const Anope::string &GetAccount() const { return account; } + const Anope::string &GetPassword() const { return password; } + + /* Hold this request. Once held it must be Release()d later on */ + void Hold(Module *m); + void Release(Module *m); + + void Success(Module *m); + + void Dispatch(); + static void ModuleUnload(Module *m); }; extern CoreExport void change_core_display(NickCore *nc); diff --git a/include/defs.h b/include/defs.h index d58f7fed6..c08d683a0 100644 --- a/include/defs.h +++ b/include/defs.h @@ -26,6 +26,7 @@ class ConnectionSocket; class DNSPacket; class dynamic_reference_base; class Entry; +class IdentifyRequest; class InfoFormatter; class ListenSocket; class Log; diff --git a/include/modules.h b/include/modules.h index 4b992a15d..14fdff066 100644 --- a/include/modules.h +++ b/include/modules.h @@ -765,15 +765,11 @@ class CoreExport Module : public Extensible */ virtual void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool ShowHidden) { } - /** Check whether a users password is correct. - * @param u The user - * @param command The command the user is doing - * @param params Command params - * @param account The account the password should be checked against - * @param password The password - * @return EVENT_ALLOW to allow the password, EVENT_STOP to stop processing completely + /** Check whether a username and password is correct + * @param u The user trying to identify, if applicable. + * @param req The login request */ - virtual EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector ¶ms, const Anope::string &account, const Anope::string &password) { return EVENT_CONTINUE; } + virtual void OnCheckAuthentication(User *u, IdentifyRequest *req) { } /** Called when a user does /ns update * @param u The user -- cgit