]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
This should fix it, thanks w00t
[user/henk/code/inspircd.git] / include / modules.h
index e14b13c9b5a591c2e7c32f2c33e34d468ec61ee0..35c439a10d6febe67eadc800fdedb3415b3624ed 100644 (file)
@@ -135,7 +135,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
                } \
                catch (CoreException& modexcept) \
                { \
-                       ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+                       ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
                } \
                _i = safei; \
        } \
@@ -159,7 +159,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
                } \
                catch (CoreException& modexcept) \
                { \
-                       z->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+                       z->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
                } \
                _i = safei; \
        } \
@@ -188,7 +188,7 @@ do { \
                } \
                catch (CoreException& modexcept) \
                { \
-                       ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+                       ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
                } \
                _i = safei; \
        } \
@@ -218,7 +218,7 @@ do { \
                } \
                catch (CoreException& modexcept) \
                { \
-                       z->Log(DEBUG,"Exception caught: %s",modexcept.GetReason()); \
+                       z->Logs->Log("MODULE",DEBUG,"Exception caught: %s",modexcept.GetReason()); \
                } \
                _i = safei; \
        } \
@@ -335,7 +335,7 @@ class CoreExport Request : public ModuleMessage
         * sent the request to. It is up to your module to know what this data is and
         * how to deal with it.
         */
-       char* Send();
+       const char* Send();
 };
 
 
@@ -401,7 +401,7 @@ enum Implementation
        I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
        I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList,
        I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed,
-       I_OnText, I_OnReadConfig, I_OnDownloadFile, I_OnPassCompare,
+       I_OnText, I_OnReadConfig, I_OnDownloadFile, I_OnPassCompare, I_OnRunTestSuite,
        I_END
 };
 
@@ -626,9 +626,10 @@ class CoreExport Module : public Extensible
         * @param source The user who is issuing the INVITE
         * @param dest The user being invited
         * @param channel The channel the user is being invited to
+        * @param timeout The time the invite will expire (0 == never)
         * @return 1 to deny the invite, 0 to allow
         */
-       virtual int OnUserPreInvite(User* source,User* dest,Channel* channel);
+       virtual int OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout);
        
        /** Called after a user has been successfully invited to a channel.
         * You cannot prevent the invite from occuring using this function, to do that,
@@ -636,8 +637,9 @@ class CoreExport Module : public Extensible
         * @param source The user who is issuing the INVITE
         * @param dest The user being invited
         * @param channel The channel the user is being invited to
+        * @param timeout The time the invite will expire (0 == never)
         */
-       virtual void OnUserInvite(User* source,User* dest,Channel* channel);
+       virtual void OnUserInvite(User* source,User* dest,Channel* channel, time_t timeout);
        
        /** Called whenever a user is about to PRIVMSG A user or a channel, before any processing is done.
         * Returning any nonzero value from this function stops the process immediately, causing no
@@ -1042,7 +1044,7 @@ class CoreExport Module : public Extensible
         * @param original_line The entire original line as passed to the parser from the user
         * @return 1 to block the command, 0 to allow
         */
-       virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, User *user, bool validated, const std::string &original_line);
+       virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line);
 
        /** Called after any command has been executed.
         * This event occurs for all registered commands, wether they are registered in the core,
@@ -1056,7 +1058,7 @@ class CoreExport Module : public Extensible
         * @param result The return code given by the command handler, one of CMD_SUCCESS or CMD_FAILURE
         * @param original_line The entire original line as passed to the parser from the user
         */
-       virtual void OnPostCommand(const std::string &command, const char** parameters, int pcnt, User *user, CmdResult result, const std::string &original_line);
+       virtual void OnPostCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, CmdResult result, const std::string &original_line);
 
        /** Called to check if a user who is connecting can now be allowed to register
         * If any modules return false for this function, the user is held in the waiting
@@ -1099,9 +1101,11 @@ class CoreExport Module : public Extensible
         * @param param The parameter for the mode or an empty string
         * @param adding true of the mode is being added, false if it is being removed
         * @param pcnt The parameter count for the mode (0 or 1)
-        * @return 1 to deny the mode, 0 to allow
+        * @return ACR_DENY to deny the mode, ACR_DEFAULT to do standard mode checking, and ACR_ALLOW
+        * to skip all permission checking. Please note that for remote mode changes, your return value
+        * will be ignored!
         */
-       virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt);
+       virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt, bool servermode = true);
 
        /** Called whenever a user joins a channel, to determine if key checks should go ahead or not.
         * This method will always be called for each join, wether or not the channel is actually +k, and
@@ -1193,7 +1197,7 @@ class CoreExport Module : public Extensible
         * may be able to use for pre-determined purposes (e.g. the results of an SQL query, etc).
         * @param request The Request class being received
         */
-       virtual char* OnRequest(Request* request);
+       virtual const char* OnRequest(Request* request);
 
        /** Called whenever a password check is to be made. Replaces the old OldOperCompare API.
         * The password field (from the config file) is in 'password' and is to be compared against
@@ -1348,6 +1352,11 @@ class CoreExport Module : public Extensible
         * @param user The user who's buffer is now empty.
         */
        virtual void OnBufferFlushed(User* user);
+
+       /** Add test suite hooks here. These are used for testing functionality of a module
+        * via the --testsuite debugging parameter.
+        */
+       virtual void OnRunTestSuite();
 };