aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_banexception.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-05-07 23:10:54 +0100
committerGravatar Sadie Powell2020-05-07 23:10:54 +0100
commiteb0f385c8dbb1fb7a6c78551ff597303adfc78e0 (patch)
treedc13ebda8ee0c8572188ca4a8369f92c5313dab4 /src/modules/m_banexception.cpp
parentFix not being able to set more than one extban. (diff)
Deduplicate extban parsing.
Diffstat (limited to 'src/modules/m_banexception.cpp')
-rw-r--r--src/modules/m_banexception.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index e267c3524..7324e7098 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -75,12 +75,10 @@ class ModuleBanException
for (const ListModeBase::ListItem ban : *list)
{
- // The mask must be in the format <letter>:<value> or <name>:<value>.
- size_t endpos = ban.mask.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
- if (endpos == std::string::npos || ban.mask[endpos] != ':')
+ std::string name, value;
+ if (!ExtBan::Parse(ban.mask, name, value))
continue;
- const std::string name(ban.mask, 0, endpos);
if (name.size() == 1)
{
// It is an extban but not this extban.
@@ -94,7 +92,6 @@ class ModuleBanException
continue;
}
- const std::string value(ban.mask, endpos + 1);
return extban->IsMatch(user, chan, value) ? MOD_RES_ALLOW : MOD_RES_PASSTHRU;
}
return MOD_RES_PASSTHRU;