summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-10-06 10:31:09 +0100
committerSadie Powell <sadie@witchery.services>2020-10-06 10:31:39 +0100
commite81dcaec7f8d3032b1931c8aa24cc945dac4c3a3 (patch)
treef9a3d87767f59a41d5b21ecd9c6cc92fd57726f3 /src
parent563be03c8c41014b18609d1bbb10b2d00ac7d315 (diff)
Recheck users for xlines when their real hostname changes.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_xline/core_xline.cpp10
-rw-r--r--src/modules.cpp1
-rw-r--r--src/users.cpp1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index 568b7d269..7a53f8566 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -77,6 +77,16 @@ class CoreModXLine : public Module
user->CheckLines(true);
}
+ void OnChangeRealHost(User* user, const std::string& newhost) CXX11_OVERRIDE
+ {
+ LocalUser* luser = IS_LOCAL(user);
+ if (!luser || luser->quitting)
+ return;
+
+ luser->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ luser->CheckLines(false);
+ }
+
ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE
{
// Check Q-lines (for local nick changes only, remote servers have our Q-lines to enforce themselves)
diff --git a/src/modules.cpp b/src/modules.cpp
index 6c7929b1f..27431e3fb 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -132,6 +132,7 @@ void Module::OnUserInvite(User*, User*, Channel*, time_t, unsigned int, CUList&
void Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); }
void Module::OnDecodeMetaData(Extensible*, const std::string&, const std::string&) { DetachEvent(I_OnDecodeMetaData); }
void Module::OnChangeHost(User*, const std::string&) { DetachEvent(I_OnChangeHost); }
+void Module::OnChangeRealHost(User*, const std::string&) { DetachEvent(I_OnChangeRealHost); }
void Module::OnChangeRealName(User*, const std::string&) { DetachEvent(I_OnChangeRealName); }
void Module::OnChangeIdent(User*, const std::string&) { DetachEvent(I_OnChangeIdent); }
void Module::OnAddLine(User*, XLine*) { DetachEvent(I_OnAddLine); }
diff --git a/src/users.cpp b/src/users.cpp
index df21dbeee..8270e2d0e 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1075,6 +1075,7 @@ void User::ChangeRealHost(const std::string& host, bool resetdisplay)
if (!changehost)
return;
+ FOREACH_MOD(OnChangeHost, (this, host));
realhost = host;
this->InvalidateCache();
}