From 3bf6454518f4a22a63dec4c5379848df34215a85 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 24 Mar 2022 02:33:45 +0000 Subject: Allow modules to handle WHO matching. --- include/modules/who.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') diff --git a/include/modules/who.h b/include/modules/who.h index d2930f97b..6e8fa024b 100644 --- a/include/modules/who.h +++ b/include/modules/who.h @@ -25,6 +25,7 @@ namespace Who { class EventListener; + class MatchEventListener; class Request; } @@ -48,6 +49,25 @@ class Who::EventListener : public Events::ModuleEventListener virtual ModResult OnWhoLine(const Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) = 0; }; +class Who::MatchEventListener + : public Events::ModuleEventListener +{ + public: + MatchEventListener(Module* mod) + : ModuleEventListener(mod, "event/who-match") + { + } + + /** Called when a WHO request needs to check if a user matches it. + * @param request Details about the WHO request which caused this match attempt. + * @param source The user who initiated this WHO request. + * @param user The user to attempt to match the WHO request against. + * @return MOD_RES_ALLOW to explicitly allow the match, MOD_RES_DENY to explicitly deny the + * match, or MOD_RES_PASSTHRU to let another module handle the event. + */ + virtual ModResult OnWhoMatch(const Request& request, LocalUser* source, User* user) = 0; +}; + class Who::Request { public: -- cgit v1.3.1-10-gc9f91