From eb0f385c8dbb1fb7a6c78551ff597303adfc78e0 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 7 May 2020 23:10:54 +0100 Subject: Deduplicate extban parsing. --- src/modules/m_banexception.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/modules/m_banexception.cpp') 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 : or :. - 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; -- cgit v1.3.1-10-gc9f91