]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_l.cpp
Clean up numeric usage in WHOIS and WHOWAS.
[user/henk/code/inspircd.git] / src / modes / cmode_l.cpp
index f057a75e6f000b12570569c50396a57e0f73f3b9..d61b2597b40444da2574c176796293ee784c0402 100644 (file)
 
 
 #include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
 #include "builtinmodes.h"
 
-ModeChannelLimit::ModeChannelLimit() : ParamChannelModeHandler(NULL, "limit", 'l')
+ModeChannelLimit::ModeChannelLimit()
+       : ParamMode<ModeChannelLimit, LocalIntExt>(NULL, "limit", 'l')
 {
 }
 
@@ -35,13 +33,17 @@ bool ModeChannelLimit::ResolveModeConflict(std::string &their_param, const std::
        return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
 }
 
-bool ModeChannelLimit::ParamValidate(std::string &parameter)
+ModeAction ModeChannelLimit::OnSet(User* user, Channel* chan, std::string& parameter)
 {
-       int limit = atoi(parameter.c_str());
-
+       int limit = ConvToInt(parameter);
        if (limit < 0)
-               return false;
+               return MODEACTION_DENY;
+
+       ext.set(chan, limit);
+       return MODEACTION_ALLOW;
+}
 
-       parameter = ConvToStr(limit);
-       return true;
+void ModeChannelLimit::SerializeParam(Channel* chan, intptr_t n, std::string& out)
+{
+       out += ConvToStr(n);
 }