X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules.h;h=2f0f48b00cd09cae2c8afe58b93324b07583c075;hb=97c7c3ff2a483e42f4e4ef900fc9ea493d498ebb;hp=64eb3cfd13fcc692a0e8c504fc838065c2b2eb5f;hpb=f209cce90b394acd26e22eacef0bff61e8f5b4e1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules.h b/include/modules.h index 64eb3cfd1..2f0f48b00 100644 --- a/include/modules.h +++ b/include/modules.h @@ -3,7 +3,7 @@ * +------------------------------------+ * * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -223,6 +223,26 @@ do { \ } \ } while (0); +#define FOREACH_RESULT_MAP(y,x,f) \ +do { \ + EventHandlerIter safei; \ + for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ) \ + { \ + safei = _i; \ + ++safei; \ + try \ + { \ + int MOD_RESULT = (*_i)->x ; \ + f; \ + } \ + catch (CoreException& modexcept) \ + { \ + ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ + } \ + _i = safei; \ + } \ +} while(0); + /** Represents a non-local user. * (in fact, any FD less than -1 does) */ @@ -739,8 +759,9 @@ class CoreExport Module : public Extensible * @param dest The target of the modes (User* or Channel*) * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text The actual modes and their parameters if any + * @param translate The translation types of the mode parameters */ - virtual void OnMode(User* user, void* dest, int target_type, const std::string &text); + virtual void OnMode(User* user, void* dest, int target_type, const std::deque &text, const std::deque &translate); /** Allows modules to alter or create server descriptions * Whenever a module requires a server description, for example for display in @@ -847,8 +868,9 @@ class CoreExport Module : public Extensible * @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL * @param target The Channel* or User* that modes should be sent for * @param modeline The modes and parameters to be sent + * @param translate The translation types of the mode parameters */ - virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline); + virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque &modeline, const std::deque &translate); /** Implemented by modules which provide the ability to link servers. * These modules will implement this method, which allows metadata (extra data added to @@ -1137,11 +1159,13 @@ class CoreExport Module : public Extensible * @param u The user to check * @param c The channel the user is on * @param type The type of extended ban to check for. + * @returns 1 = exempt, 0 = no match, -1 = banned */ virtual int OnCheckExtBan(User *u, Channel *c, char type); /** Called whenever checking whether or not a string is extbanned. NOTE: one OnCheckExtBan will also trigger a number of * OnCheckStringExtBan events for seperate host/IP comnbinations. + * @returns 1 = exempt, 0 = no match, -1 = banned */ virtual int OnCheckStringExtBan(const std::string &s, Channel *c, char type); @@ -1602,17 +1626,6 @@ typedef std::vector IntModuleList; */ typedef IntModuleList::iterator EventHandlerIter; -/** Module priority states - */ -enum PriorityState -{ - PRIO_DONTCARE, - PRIO_FIRST, - PRIO_LAST, - PRIO_AFTER, - PRIO_BEFORE -}; - /** ModuleManager takes care of all things module-related * in the core. */ @@ -1680,7 +1693,7 @@ class CoreExport ModuleManager : public classbase * Defaults to 1, as most of the time you will only want to prioritize your module * to be before or after one other module. */ - bool SetPriority(Module* mod, Implementation i, PriorityState s, Module** modules = NULL, size_t sz = 1); + bool SetPriority(Module* mod, Implementation i, Priority s, Module** modules = NULL, size_t sz = 1); /** Change the priority of all events in a module. * @param mod The module to set the priority of @@ -1690,7 +1703,7 @@ class CoreExport ModuleManager : public classbase * SetPriority method for this, where you may specify other modules to * be prioritized against. */ - bool SetPriority(Module* mod, PriorityState s); + bool SetPriority(Module* mod, Priority s); /** Attach an event to a module. * You may later detatch the event with ModuleManager::Detach().