From e81dcaec7f8d3032b1931c8aa24cc945dac4c3a3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Oct 2020 10:31:09 +0100 Subject: Recheck users for xlines when their real hostname changes. --- src/coremods/core_xline/core_xline.cpp | 10 ++++++++++ src/modules.cpp | 1 + src/users.cpp | 1 + 3 files changed, 12 insertions(+) (limited to 'src') 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(); } -- cgit v1.2.3