/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2017, 2019 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2006, 2010 Craig Edwards <brain@inspircd.org>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
ModeChannelLimit::ModeChannelLimit(Module* Creator)
: ParamMode<ModeChannelLimit, LocalIntExt>(Creator, "limit", 'l')
+ , minlimit(0)
{
+ syntax = "<limit>";
}
bool ModeChannelLimit::ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel*)
{
/* When TS is equal, the higher channel limit wins */
- return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
+ return ConvToNum<intptr_t>(their_param) < ConvToNum<intptr_t>(our_param);
}
ModeAction ModeChannelLimit::OnSet(User* user, Channel* chan, std::string& parameter)
{
- int limit = ConvToInt(parameter);
- if (limit < 0)
+ size_t limit = ConvToNum<size_t>(parameter);
+ if (limit < minlimit)
return MODEACTION_DENY;
ext.set(chan, limit);