]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Documentation change to indicate errno is valid on return from the constructor -...
[user/henk/code/inspircd.git] / include / modules.h
index 337064eb3bdaca72a05205750c65522a35876a9a..8bc52b683db6b51acecf12570b1f20a96e1837bd 100644 (file)
@@ -75,7 +75,7 @@ enum MessageType {
  * ipv4 servers, so this value will be ten times as
  * high on ipv6 servers.
  */
-#define NATIVE_API_VERSION 11008
+#define NATIVE_API_VERSION 11011
 #ifdef IPV6
 #define API_VERSION (NATIVE_API_VERSION * 10)
 #else
@@ -394,7 +394,7 @@ enum Implementation {       I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
                        I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan,
                        I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
                        I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList,
-                       I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect };
+                       I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect };
 
 /** Base class for all InspIRCd modules
  *  This class is the base class for InspIRCd modules. All modules must inherit from this class,
@@ -518,9 +518,11 @@ class Module : public Extensible
         * system. You should use it to reload any files so that your module keeps in step with the
         * rest of the application. If a parameter is given, the core has done nothing. The module
         * receiving the event can decide if this parameter has any relevence to it.
+        * @param user The user performing the rehash, if any -- if this is server initiated, the
+        * value of this variable will be NULL.
         * @param parameter The (optional) parameter given to REHASH from the user.
         */
-       virtual void OnRehash(const std::string &parameter);
+       virtual void OnRehash(userrec* user, const std::string &parameter);
 
        /** Called when a raw command is transmitted or received.
         * This method is the lowest level of handler available to a module. It will be called with raw
@@ -1341,6 +1343,13 @@ class Module : public Extensible
         * receive it, or zero to allow the line to be sent.
         */
        virtual int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text);
+
+       /** Called at intervals for modules to garbage-collect any hashes etc.
+        * Certain data types such as hash_map 'leak' buckets, which must be
+        * tidied up and freed by copying into a new item every so often. This
+        * method is called when it is time to do that.
+        */
+       virtual void OnGarbageCollect();
 };
 
 
@@ -1387,17 +1396,33 @@ class ConfigReader : public classbase
         * This method destroys the ConfigReader class.
         */
        ~ConfigReader();
+
        /** Retrieves a value from the config file.
         * This method retrieves a value from the config file. Where multiple copies of the tag
         * exist in the config file, index indicates which of the values to retrieve.
         */
        std::string ReadValue(const std::string &tag, const std::string &name, int index, bool allow_linefeeds = false);
+       /** Retrieves a value from the config file.
+        * This method retrieves a value from the config file. Where multiple copies of the tag
+        * exist in the config file, index indicates which of the values to retrieve. If the
+        * tag is not found the default value is returned instead.
+        */
+       std::string ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds = false);
+
        /** Retrieves a boolean value from the config file.
         * This method retrieves a boolean value from the config file. Where multiple copies of the tag
         * exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
         * and "true" in the config file count as true to ReadFlag, and any other value counts as false.
         */
        bool ReadFlag(const std::string &tag, const std::string &name, int index);
+       /** Retrieves a boolean value from the config file.
+        * This method retrieves a boolean value from the config file. Where multiple copies of the tag
+        * exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
+        * and "true" in the config file count as true to ReadFlag, and any other value counts as false.
+        * If the tag is not found, the default value is used instead.
+        */
+       bool ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index);
+
        /** Retrieves an integer value from the config file.
         * This method retrieves an integer value from the config file. Where multiple copies of the tag
         * exist in the config file, index indicates which of the values to retrieve. Any invalid integer
@@ -1407,6 +1432,16 @@ class ConfigReader : public classbase
         * will return CONF_NOT_UNSIGNED
         */
        long ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned);
+       /** Retrieves an integer value from the config file.
+        * This method retrieves an integer value from the config file. Where multiple copies of the tag
+        * exist in the config file, index indicates which of the values to retrieve. Any invalid integer
+        * values in the tag will cause the objects error value to be set, and any call to GetError() will
+        * return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned.
+        * If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError()
+        * will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead.
+        */
+       long ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool needs_unsigned);
+
        /** Returns the last error to occur.
         * Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition.
         * A call to GetError() resets the error flag back to 0.