class CoreExport ModeParser : public fakederef<ModeParser>
{
public:
+ /** The maximum number of modes which can be created. */
static const ModeHandler::Id MODEID_MAX = 64;
+ /** The maximum length of a mode parameter. */
+ static const size_t MODE_PARAM_MAX = 250;
+
/** Type of the container that maps mode names to ModeHandlers
*/
typedef TR1NS::unordered_map<std::string, ModeHandler*, irc::insensitive, irc::StrHashComp> ModeHandlerMap;
if (tidy)
ModeParser::CleanMask(parameter);
- if (parameter.length() > 250)
- return MODEACTION_DENY;
-
// If there was no list
if (!cd)
{
const bool needs_param = mh->NeedsParam(adding);
std::string& parameter = mcitem.param;
- // crop mode parameter size to 250 characters
- if (parameter.length() > 250 && adding)
- parameter.erase(250);
+ // crop mode parameter size to MODE_PARAM_MAX characters
+ if (parameter.length() > MODE_PARAM_MAX && adding)
+ parameter.erase(MODE_PARAM_MAX);
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mh, parameter, adding));
{
ConfigTag* tag = ServerInstance->Config->ConfValue("chanfilter");
hidemask = tag->getBool("hidemask");
- cf.maxlen = tag->getUInt("maxlen", 35, 10, 100);
+ cf.maxlen = tag->getUInt("maxlen", 35, 10, ModeParser::MODE_PARAM_MAX);
notifyuser = tag->getBool("notifyuser", true);
cf.DoRehash();
}