]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Avoid doing more work than necessary when checking the O: extban.
authorSadie Powell <sadie@witchery.services>
Fri, 25 Dec 2020 03:46:43 +0000 (03:46 +0000)
committerSadie Powell <sadie@witchery.services>
Fri, 25 Dec 2020 03:46:43 +0000 (03:46 +0000)
src/modules/m_operchans.cpp

index 0725952699c65a26b425b83c00a601ef7d118ed9..f133d85f746d13ca9d0b98b00da0956fc36c3048 100644 (file)
@@ -66,15 +66,10 @@ class ModuleOperChans : public Module
                if (!user->IsOper())
                        return MOD_RES_PASSTHRU;
 
-               // Check whether the oper's type matches the ban.
-               const std::string submask = mask.substr(2);
-               if (InspIRCd::Match(user->oper->name, submask))
-                       return MOD_RES_DENY;
-
-               // If the oper's type contains spaces recheck with underscores.
+               // Replace spaces with underscores as they're prohibited in mode parameters.
                std::string opername(user->oper->name);
                stdalgo::string::replace_all(opername, space, underscore);
-               if (InspIRCd::Match(opername, submask))
+               if (InspIRCd::Match(opername, mask.substr(2)))
                        return MOD_RES_DENY;
 
                return MOD_RES_PASSTHRU;