diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-24 00:42:22 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-24 00:42:22 +0000 |
commit | b31a8ee0ad3795855a12bfaaf5a9034fe3c4db39 (patch) | |
tree | 12cd3b8960bf45e869540d385b58da0faf6d3f45 | |
parent | 73ddc65a2833f7ac34b841b89bca3c40c60420d4 (diff) |
Add OnGarbageCollect method
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6086 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modules.h | 11 | ||||
-rw-r--r-- | src/cmd_modules.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/include/modules.h b/include/modules.h index 337064eb3..3c9899ded 100644 --- a/include/modules.h +++ b/include/modules.h @@ -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 11009 #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, @@ -1341,6 +1341,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(); }; diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp index 8b23a823e..755f2d9f3 100644 --- a/src/cmd_modules.cpp +++ b/src/cmd_modules.cpp @@ -31,7 +31,7 @@ char* itab[] = { "OnPostLocalTopicChange", "OnEvent", "OnRequest", "OnOperCompre", "OnGlobalOper", "OnPostConnect", "OnAddBan", "OnDelBan", "OnRawSocketAccept", "OnRawSocketClose", "OnRawSocketWrite", "OnRawSocketRead", "OnChangeLocalUserGECOS", "OnUserRegister", "OnOperCompare", "OnChannelDelete", "OnPostOper", "OnSyncOtherMetaData", "OnSetAway", "OnCancelAway", "OnNamesList", - "OnPostCommand", "OnPostJoin", "OnWhoisLine", "OnBuildExemptList", "OnRawSocketConnect", NULL + "OnPostCommand", "OnPostJoin", "OnWhoisLine", "OnBuildExemptList", "OnRawSocketConnect", "OnGarbageCollect", NULL }; extern "C" command_t* init_command(InspIRCd* Instance) diff --git a/src/modules.cpp b/src/modules.cpp index acd2ae469..b218c63ee 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -191,6 +191,7 @@ void Module::OnCancelAway(userrec* user) { }; int Module::OnUserList(userrec* user, chanrec* Ptr) { return 0; }; int Module::OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text) { return 0; }; void Module::OnBuildExemptList(MessageType message_type, chanrec* chan, userrec* sender, char status, CUList &exempt_list) { }; +void Module::OnGarbageCollect() { }; long InspIRCd::PriorityAfter(const std::string &modulename) { |