diff options
author | genius3000 <genius3000@g3k.solutions> | 2018-03-30 10:08:22 -0600 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-03-30 17:08:22 +0100 |
commit | fdeccd7dd366ebac516ed66841fbf7f0952d8ed2 (patch) | |
tree | 4cb5e141298d4d3c45c38104c90ed094cc31e478 /src/modules | |
parent | ded44748551a0aaa117420324f324168dadaf1db (diff) |
Update the GeoIP ExtItem when CGI:IRC sets the real IP (#1471)
Since CGI:IRC calls it's 'ChangeIP()' either from 'OnCheckReady()'
or 'OnUserRegister()', both of which are called after the user has
sent NICK/USER, we can safely skip re-setting the ExtItem prior to
this point.
This skips the first 'OnSetUserIP()' from 'User::AddUser()' as
the 'OnSetConnectClass()' catch handles the initial setting.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_geoip.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index a36c39bc8..03b7a55f7 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -58,7 +58,7 @@ class ModuleGeoIP : public Module throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?"); ServerInstance->Modules->AddService(ext); - Implementation eventlist[] = { I_OnSetConnectClass, I_OnStats }; + Implementation eventlist[] = { I_OnSetConnectClass, I_OnSetUserIP, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i) @@ -99,6 +99,13 @@ class ModuleGeoIP : public Module return MOD_RES_DENY; } + void OnSetUserIP(LocalUser* user) + { + // If user has sent NICK/USER, re-set the ExtItem as this is likely CGI:IRC changing the IP + if (user->registered == REG_NICKUSER) + SetExt(user); + } + ModResult OnStats(char symbol, User* user, string_list &out) { if (symbol != 'G') |