From 91abba488ad4b2c5bf59c720cde387b6390528d9 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 9 Jul 2012 15:34:44 +0200 Subject: New OnUserSetIP() hook --- include/modules.h | 10 ++++++++-- src/modules.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/modules.h b/include/modules.h index 49c16ae61..281da2705 100644 --- a/include/modules.h +++ b/include/modules.h @@ -116,7 +116,7 @@ struct ModResult { * and numerical comparisons in preprocessor macros if they wish to support * multiple versions of InspIRCd in one file. */ -#define INSPIRCD_VERSION_API 1 +#define INSPIRCD_VERSION_API 2 /** * This #define allows us to call a method in all @@ -338,7 +338,7 @@ enum Implementation I_OnPostOper, I_OnSyncNetwork, I_OnSetAway, I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildNeighborList, I_OnGarbageCollect, I_OnSetConnectClass, I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookIO, - I_OnPreRehash, I_OnModuleRehash, I_OnSendWhoLine, I_OnChangeIdent, + I_OnPreRehash, I_OnModuleRehash, I_OnSendWhoLine, I_OnChangeIdent, I_OnSetUserIP, I_END }; @@ -1288,6 +1288,12 @@ class CoreExport Module : public classbase, public usecountbase * @param line The raw line to send; modifiable, if empty no line will be returned. */ virtual void OnSendWhoLine(User* source, const std::vector& params, User* user, std::string& line); + + /** Called whenever a local user's IP is set for the first time, or when a local user's IP changes due to + * a module like m_cgiirc changing it. + * @param user The user whose IP is being set + */ + virtual void OnSetUserIP(LocalUser* user); }; diff --git a/src/modules.cpp b/src/modules.cpp index ccd78a8f0..075bbf85b 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -176,6 +176,7 @@ ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MO void Module::OnHookIO(StreamSocket*, ListenSocket*) { } ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { return MOD_RES_PASSTHRU; } void Module::OnSendWhoLine(User*, const std::vector&, User*, std::string&) { } +void Module::OnSetUserIP(LocalUser*) { } ModuleManager::ModuleManager() : ModCount(0) { -- cgit v1.2.3