From 8c2135aad0b2bbd8afca21a6c0664a9e4182dc9b Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 11 Feb 2015 16:46:11 +0100 Subject: Convert the account login event to use the new cross-module event system --- include/modules/account.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/modules/account.h b/include/modules/account.h index c00b044e4..0368127a6 100644 --- a/include/modules/account.h +++ b/include/modules/account.h @@ -22,16 +22,7 @@ #include #include -class AccountEvent : public Event -{ - public: - User* const user; - const std::string account; - AccountEvent(Module* me, User* u, const std::string& name) - : Event(me, "account_login"), user(u), account(name) - { - } -}; +#include "event.h" typedef StringExtItem AccountExtItem; @@ -39,3 +30,19 @@ inline AccountExtItem* GetAccountExtItem() { return static_cast(ServerInstance->Extensions.GetItem("accountname")); } + +class AccountEventListener : public Events::ModuleEventListener +{ + public: + AccountEventListener(Module* mod) + : ModuleEventListener(mod, "event/account") + { + } + + /** Called when a user logs in or logs out + * @param user User logging in or out + * @param newaccount New account name of the user or empty string if the user + * logged out + */ + virtual void OnAccountChange(User* user, const std::string& newaccount) = 0; +}; -- cgit v1.2.3