/* $ModDesc: Provides channel mode +j (join flood protection) */
-class joinfloodsettings
+class joinfloodsettings : public classbase
{
public:
public:
JoinFlood() : ModeHandler('j', 1, 0, false, MODETYPE_CHANNEL, false) { }
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter)
+ {
+ joinfloodsettings* x;
+ if (channel->GetExt("joinflood",x))
+ return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs));
+ else
+ return std::make_pair(false, parameter);
+ }
+
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ {
+ /* When TS is equal, the alphabetically later one wins */
+ return (their_param < our_param);
+ }
+
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
{
joinfloodsettings* dummy;
{
f->clear();
f->lock();
- WriteChannelWithServ((char*)Srv->GetServerName().c_str(), channel, "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.",channel->name,f->joins,f->secs);
+ channel->WriteChannelWithServ((char*)Srv->GetServerName().c_str(), "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", channel->name, f->joins, f->secs);
}
}
}