summaryrefslogtreecommitdiff
path: root/modules/protocol/inspircd.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-10-04 13:01:29 +0100
committerSadie Powell <sadie@witchery.services>2024-10-04 13:01:29 +0100
commit4cdbf560e196af86935b1b730af84412c8b25ecb (patch)
tree582e033909dbc3a48ab4b57ff2d9b597a6f27d4a /modules/protocol/inspircd.cpp
parentcbccc79d37b2ca015c65e1a641dc46ed2bdca80d (diff)
Fix matching extended bans in services.
Extended bans are stored without their prefix. Therefore, we should not try to strip their prefix before matching. Closes #288. Co-authored-by: k4be <k4be@pirc.pl>
Diffstat (limited to 'modules/protocol/inspircd.cpp')
-rw-r--r--modules/protocol/inspircd.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index 8f88e6f89..b3e44b464 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -761,10 +761,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
-
- return Entry(this->name, real_mask).Matches(u);
+ return Entry(this->name, e->GetMask()).Matches(u);
}
};
@@ -779,10 +776,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
-
- Anope::string channel = mask.substr(2);
-
+ auto channel = e->GetMask();
ChannelMode *cm = NULL;
if (channel[0] != '#')
{
@@ -817,10 +811,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
-
- return u->IsIdentified() && real_mask.equals_ci(u->Account()->display);
+ return u->IsIdentified() && e->GetMask().equals_ci(u->Account()->display);
}
};
@@ -835,9 +826,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
- return Anope::Match(u->realname, real_mask);
+ return Anope::Match(u->realname, e->GetMask());
}
};
@@ -852,9 +841,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
- return Anope::Match(u->server->GetName(), real_mask);
+ return Anope::Match(u->server->GetName(), e->GetMask());
}
};
@@ -869,9 +856,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
- return !u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask);
+ return !u->fingerprint.empty() && Anope::Match(u->fingerprint, e->GetMask());
}
};
@@ -886,9 +871,7 @@ namespace InspIRCdExtBan
bool Matches(User *u, const Entry *e) override
{
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
- return !u->Account() && Entry("BAN", real_mask).Matches(u);
+ return !u->Account() && Entry("BAN", e->GetMask()).Matches(u);
}
};
@@ -907,9 +890,7 @@ namespace InspIRCdExtBan
if (!opertype)
return false; // Not an operator.
- const Anope::string &mask = e->GetMask();
- Anope::string real_mask = mask.substr(2);
- return Anope::Match(opertype->replace_all_cs(' ', '_'), real_mask);
+ return Anope::Match(opertype->replace_all_cs(' ', '_'), e->GetMask());
}
};
}