X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules%2Fexemption.h;h=9319c4737cd3dcde1aa095acb08e69048d7e6f2a;hb=d3a7ac87cb9ef8687f7fec09f54a570f9858efb4;hp=2f4ee02fc47a207add1fd8e427bbfd2350bee23a;hpb=a3e0768758ca68429a29d9c78ce672f2d938c6e7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/exemption.h b/include/modules/exemption.h index 2f4ee02fc..9319c4737 100644 --- a/include/modules/exemption.h +++ b/include/modules/exemption.h @@ -1,7 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2016-2017 Peter Powell + * Copyright (C) 2017, 2019 Sadie Powell * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -25,14 +25,24 @@ namespace CheckExemption { class EventListener; class EventProvider; + + /** Helper function for calling the CheckExemption::EventListener::OnCheckExemption event. + * @param prov The CheckExemption::EventProvider which is calling the event. + * @param user The user to check exemption for. + * @param chan The channel to check exemption on. + * @param restriction The restriction to check for. + * @return Either MOD_RES_ALLOW if the exemption was confirmed, MOD_RES_DENY if the exemption was + * denied or MOD_RES_PASSTHRU if no module handled the event. + */ + inline ModResult Call(const CheckExemption::EventProvider& prov, User* user, Channel* chan, const std::string& restriction); } class CheckExemption::EventListener : public Events::ModuleEventListener { protected: - EventListener(Module* mod) - : ModuleEventListener(mod, "event/exemption") + EventListener(Module* mod, unsigned int eventprio = DefaultPriority) + : ModuleEventListener(mod, "event/exemption", eventprio) { } @@ -56,3 +66,10 @@ class CheckExemption::EventProvider { } }; + +inline ModResult CheckExemption::Call(const CheckExemption::EventProvider& prov, User* user, Channel* chan, const std::string& restriction) +{ + ModResult result; + FIRST_MOD_RESULT_CUSTOM(prov, CheckExemption::EventListener, OnCheckExemption, result, (user, chan, restriction)); + return result; +}