#include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
-#include "modes/cmode_l.h"
+#include "builtinmodes.h"
-ModeChannelLimit::ModeChannelLimit() : ParamChannelModeHandler(NULL, "limit", 'l')
+ModeChannelLimit::ModeChannelLimit()
+ : ParamMode<ModeChannelLimit, LocalIntExt>(NULL, "limit", 'l')
{
}
return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
}
-bool ModeChannelLimit::ParamValidate(std::string ¶meter)
+ModeAction ModeChannelLimit::OnSet(User* user, Channel* chan, std::string& parameter)
{
- int limit = atoi(parameter.c_str());
-
- if (limit < 0)
- return false;
+ ext.set(chan, ConvToInt(parameter));
+ return MODEACTION_ALLOW;
+}
- parameter = ConvToStr(limit);
- return true;
+void ModeChannelLimit::SerializeParam(Channel* chan, intptr_t n, std::string& out)
+{
+ out += ConvToStr(n);
}