5 #include "modes/cmode_l.h"
7 ModeChannelLimit::ModeChannelLimit() : ModeHandler('l', 1, 0, false, MODETYPE_CHANNEL, false)
11 ModeAction ModeChannelLimit::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
15 /* Setting a new limit, sanity check */
16 long limit = atoi(parameter.c_str());
18 /* Wrap low values at 32768 */
22 /* If the new limit is the same as the old limit,
23 * and the old limit isnt 0, disallow */
24 if ((limit == channel->limit) && (channel->limit > 0))
27 return MODEACTION_DENY;
30 /* They must have specified an invalid number.
36 return MODEACTION_DENY;
39 parameter = ConvToStr(limit);
42 channel->limit = limit;
43 channel->modes[CM_LIMIT] = 1;
45 return MODEACTION_ALLOW;
49 /* Check if theres a limit here to remove.
50 * If there isnt, dont allow the -l
55 return MODEACTION_DENY;
58 /* Removing old limit, no checks here */
60 channel->modes[CM_LIMIT] = 0;
62 return MODEACTION_ALLOW;
65 return MODEACTION_DENY;