X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_l.cpp;h=3bdacd60e42f7d574f57430b650c3aa9a6b12b64;hb=74d221e54a8db39820f6f86104116f74f9939b01;hp=185cbdedb93c0ff040e1bfd85659e35deb73d453;hpb=4260fd62272dbd0de84f51bedbd5dd4a088afb1a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp index 185cbdedb..3bdacd60e 100644 --- a/src/modes/cmode_l.cpp +++ b/src/modes/cmode_l.cpp @@ -4,10 +4,28 @@ #include "users.h" #include "modes/cmode_l.h" -ModeChannelLimit::ModeChannelLimit() : ModeHandler('l', 1, 0, false, MODETYPE_CHANNEL, false) +ModeChannelLimit::ModeChannelLimit(InspIRCd* Instance) : ModeHandler(Instance, 'l', 1, 0, false, MODETYPE_CHANNEL, false) { } +ModePair ModeChannelLimit::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + if (channel->limit) + { + return std::make_pair(true, ConvToStr(channel->limit)); + } + else + { + return std::make_pair(false, parameter); + } +} + +bool ModeChannelLimit::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) +{ + /* When TS is equal, the higher channel limit wins */ + return (atoi(their_param.c_str()) < atoi(our_param.c_str())); +} + ModeAction ModeChannelLimit::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { if (adding) @@ -36,6 +54,8 @@ ModeAction ModeChannelLimit::OnModeChange(userrec* source, userrec* dest, chanre return MODEACTION_DENY; } + parameter = ConvToStr(limit); + /* Set new limit */ channel->limit = limit; channel->modes[CM_LIMIT] = 1;