From 48bb6089fa6fcf0771481a8575b2385ce9a69a20 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 26 Jan 2026 18:57:29 +0000 Subject: [PATCH] Swap the mode and mask params to Entry and make the mode optional. --- include/modes.h | 4 ++-- modules/chanserv/cs_access.cpp | 2 +- modules/chanserv/cs_akick.cpp | 2 +- modules/chanserv/cs_flags.cpp | 2 +- modules/chanserv/cs_xop.cpp | 2 +- modules/protocol/inspircd.cpp | 4 ++-- modules/protocol/unrealircd.cpp | 4 ++-- src/modes.cpp | 2 +- src/protocol.cpp | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/modes.h b/include/modes.h index 4b008978c..4113f63ae 100644 --- a/include/modes.h +++ b/include/modes.h @@ -441,11 +441,11 @@ public: Anope::string nick, user, host, real; /** Constructor - * @param mode What mode this host is for, can be empty for unknown/no mode * @param mask A full or partial nick!ident@host/cidr#real name mask + * @param mode What mode this host is for, can be empty for unknown/no mode * @Param real Whether to allow a real name in the mask. */ - Entry(const Anope::string &mode, const Anope::string &mask, bool real = true); + Entry(const Anope::string &mask, const Anope::string &mode = "", bool real = true); /** Get the banned mask for this entry * @return The mask diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp index 8d6d773a7..e6886a0af 100644 --- a/modules/chanserv/cs_access.cpp +++ b/modules/chanserv/cs_access.cpp @@ -226,7 +226,7 @@ private: else { // Normalize the entry mask. - mask = Entry("", mask).GetCleanMask(); + mask = Entry(mask).GetCleanMask(); } } } diff --git a/modules/chanserv/cs_akick.cpp b/modules/chanserv/cs_akick.cpp index 49c8cac4a..c5fddfd52 100644 --- a/modules/chanserv/cs_akick.cpp +++ b/modules/chanserv/cs_akick.cpp @@ -796,7 +796,7 @@ public: kick = chan != NULL && chan->FindUser(u); } else - kick = Entry("BAN", autokick->mask).Matches(u); + kick = Entry(autokick->mask, "BAN").Matches(u); if (kick) { diff --git a/modules/chanserv/cs_flags.cpp b/modules/chanserv/cs_flags.cpp index 470ef9680..304599eb1 100644 --- a/modules/chanserv/cs_flags.cpp +++ b/modules/chanserv/cs_flags.cpp @@ -153,7 +153,7 @@ class CommandCSFlags final else { // Normalize the entry mask. - mask = Entry("", mask).GetCleanMask(); + mask = Entry(mask).GetCleanMask(); } } } diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp index 53fb7a5f4..69e02cc4d 100644 --- a/modules/chanserv/cs_xop.cpp +++ b/modules/chanserv/cs_xop.cpp @@ -201,7 +201,7 @@ private: else { // Normalize the entry mask. - mask = Entry("", mask).GetCleanMask(); + mask = Entry(mask).GetCleanMask(); } } } diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index 11a85daa4..6f620b51a 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -788,7 +788,7 @@ namespace InspIRCdExtBan bool Matches(User *u, const Entry *e) override { - return Entry(this->name, e->GetMask(), false).Matches(u); + return Entry(e->GetMask(), this->name, false).Matches(u); } }; @@ -898,7 +898,7 @@ namespace InspIRCdExtBan bool Matches(User *u, const Entry *e) override { - return !u->Account() && Entry(this->base, e->GetMask(), false).Matches(u); + return !u->Account() && Entry(e->GetMask(), this->base, false).Matches(u); } }; diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index 728a77f83..5de685feb 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -564,7 +564,7 @@ namespace UnrealExtBan bool Matches(User *u, const Entry *e) override { - return Entry(this->base, e->GetMask(), false).Matches(u); + return Entry(e->GetMask(), this->base, false).Matches(u); } }; @@ -646,7 +646,7 @@ namespace UnrealExtBan /* strip down the time (~t:1234:) and call other matchers */ auto real_mask = e->GetMask(); real_mask = real_mask.substr(real_mask.find(":") + 1); - return Entry("BAN", real_mask, false).Matches(u); + return Entry(real_mask, "BAN", false).Matches(u); } }; diff --git a/src/modes.cpp b/src/modes.cpp index 61a66a314..96212529a 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -673,7 +673,7 @@ void ModeManager::StackerDel(Mode *m) } } -Entry::Entry(const Anope::string &n, const Anope::string &m, bool r) +Entry::Entry(const Anope::string &m, const Anope::string &n, bool r) : name(n) , mask(m) { diff --git a/src/protocol.cpp b/src/protocol.cpp index 69eba97ba..efca42405 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -389,7 +389,7 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask) { if (IsExtbanValid(mask)) return mask; - return Entry("", mask).GetCleanMask(); + return Entry(mask).GetCleanMask(); } void IRCDProto::SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg, const Anope::map &tags)