diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-26 17:26:16 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-26 17:26:16 +0000 |
commit | a9b90ecb4329498aba52da6aaa9812e3a70b8e11 (patch) | |
tree | 38053a6bfa07486c6fc5cc46ebddb5e32306014a /include | |
parent | dab3dc93c177400a749400c61c9253be055b78e3 (diff) |
Adding hook type checking to event calls to speed them up
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2653 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/inspircd_io.h | 4 | ||||
-rw-r--r-- | include/modules.h | 32 |
2 files changed, 30 insertions, 6 deletions
diff --git a/include/inspircd_io.h b/include/inspircd_io.h index 158794555..86ab543a5 100644 --- a/include/inspircd_io.h +++ b/include/inspircd_io.h @@ -251,6 +251,10 @@ class ServerConfig : public classbase */ int ports[255]; + /** Boolean sets of which modules implement which functions + */ + char implement_lists[255][255]; + /** A list of ports claimed by IO Modules */ std::map<int,Module*> IOHookModule; diff --git a/include/modules.h b/include/modules.h index 4ce96a45d..28dbadb2e 100644 --- a/include/modules.h +++ b/include/modules.h @@ -61,6 +61,7 @@ #include <string> #include <deque> #include <sstream> +#include <typeinfo> class Server; class ServerConfig; @@ -79,7 +80,10 @@ typedef std::deque<userrec*> chanuserlist; // loaded modules in a readable simple way, e.g.: // 'FOREACH_MOD OnConnect(user);' -#define FOREACH_MOD for (int _i = 0; _i <= MODCOUNT; _i++) modules[_i]-> +#define FOREACH_MOD(y,x) for (int _i = 0; _i <= MODCOUNT; _i++) { \ + if (Config->implement_lists[_i][y]) \ + modules[_i]->x ; \ + } // This define is similar to the one above but returns a result in MOD_RESULT. // The first module to return a nonzero result is the value to be accepted, @@ -87,12 +91,14 @@ typedef std::deque<userrec*> chanuserlist; // ********************************************************************************************* -#define FOREACH_RESULT(x) { MOD_RESULT = 0; \ +#define FOREACH_RESULT(y,x) { MOD_RESULT = 0; \ for (int _i = 0; _i <= MODCOUNT; _i++) { \ - int res = modules[_i]->x ; \ - if (res != 0) { \ - MOD_RESULT = res; \ - break; \ + if (Config->implement_lists[_i][y]) {\ + int res = modules[_i]->x ; \ + if (res != 0) { \ + MOD_RESULT = res; \ + break; \ + } \ } \ } \ } @@ -264,6 +270,18 @@ class ExtMode : public classbase }; +enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, + I_OnExtendedMode, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnInfo, I_OnWhois, I_OnUserPreInvite, + I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode, + I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData, + I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddGLine, + I_OnAddZLine, I_OnAddQLine, I_OnAddKLine, I_OnAddELine, I_OnDelGLine, I_OnDelZLine, I_OnDelKLine, I_OnDelELine, I_OnDelQLine, + I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule, + I_OnBackgroundTimer, I_OnSendList, I_OnPreCommand, I_OnCheckReady, I_OnUserRrgister, I_OnRawMode, I_OnCheckInvite, + I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, + I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnGlobalConnect, I_OnAddBan, I_OnDelBan, + I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead }; + /** Base class for all InspIRCd modules * This class is the base class for InspIRCd modules. All modules must inherit from this class, * its methods will be called when irc server events occur. class inherited from module must be @@ -290,6 +308,8 @@ class Module : public classbase */ virtual Version GetVersion(); + virtual void Implements(bool &Implements[255]); + /** Called when a user connects. * The details of the connecting user are available to you in the parameter userrec *user * @param user The user who is connecting |