]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Added RemoveSocket as a test fix for merwins bug
[user/henk/code/inspircd.git] / include / modules.h
index 28dbadb2ee2e63f9803891171ff242616a66fe13..a7fc2e732505b4ee11dde1a2c7beb862e7a31901 100644 (file)
@@ -80,10 +80,12 @@ typedef std::deque<userrec*> chanuserlist;
 // loaded modules in a readable simple way, e.g.:
 // 'FOREACH_MOD OnConnect(user);'
 
-#define FOREACH_MOD(y,x) for (int _i = 0; _i <= MODCOUNT; _i++) { \
+#define FOREACH_MOD(y,x) if (Config->global_implementation[y] > 0) { \
+       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,
@@ -91,7 +93,8 @@ typedef std::deque<userrec*> chanuserlist;
 
 // *********************************************************************************************
 
-#define FOREACH_RESULT(y,x) { MOD_RESULT = 0; \
+#define FOREACH_RESULT(y,x) { if (Config->global_implementation[y] > 0) { \
+                       MOD_RESULT = 0; \
                        for (int _i = 0; _i <= MODCOUNT; _i++) { \
                        if (Config->implement_lists[_i][y]) {\
                                int res = modules[_i]->x ; \
@@ -101,7 +104,8 @@ typedef std::deque<userrec*> chanuserlist;
                                } \
                        } \
                } \
-       } 
+       } \
+ }
    
 // *********************************************************************************************
 
@@ -270,6 +274,8 @@ class ExtMode : public classbase
 };
 
 
+enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST };
+
 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,
@@ -280,7 +286,8 @@ enum Implementation {       I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
                        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 };
+                       I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
+                       I_OnOperCompare };
 
 /** Base class for all InspIRCd modules
  *  This class is the base class for InspIRCd modules. All modules must inherit from this class,
@@ -308,7 +315,9 @@ class Module : public classbase
         */
        virtual Version GetVersion();
 
-       virtual void Implements(bool &Implements[255]);
+       virtual void Implements(char* Implements);
+
+       virtual Priority Prioritize();
 
        /** Called when a user connects.
         * The details of the connecting user are available to you in the parameter userrec *user
@@ -982,8 +991,10 @@ class Module : public classbase
        /** Called on all /STATS commands
         * This method is triggered for all /STATS use, including stats symbols handled by the core.
         * @param symbol the symbol provided to /STATS
+        * @user the user issuing the /STATS command
+        * @return 1 to block the /STATS from being processed by the core, 0 to allow it
         */
-       virtual void OnStats(char symbol);
+       virtual int OnStats(char symbol, userrec* user);
 
        /** Called whenever a change of a local users displayed host is attempted.
         * Return 1 to deny the host change, or 0 to allow it.
@@ -1548,6 +1559,10 @@ class Server : public classbase
         */
        virtual void AddSocket(InspSocket* sock);
 
+       /** Forcibly removes a class derived from InspSocket from the servers socket engine.
+        */
+       virtual void RemoveSocket(InspSocket* sock);
+
        /** Deletes a class derived from InspSocket from the server's socket engine.
         */
        virtual void DelSocket(InspSocket* sock);