* ipv4 servers, so this value will be ten times as
* high on ipv6 servers.
*/
-#define NATIVE_API_VERSION 11008
+#define NATIVE_API_VERSION 11010
#ifdef IPV6
#define API_VERSION (NATIVE_API_VERSION * 10)
#else
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,
* 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 ¶meter);
+ virtual void OnRehash(userrec* user, const std::string ¶meter);
/** 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
* 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();
};
* 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
* 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.