From: dms Date: Sat, 14 Apr 2001 14:48:24 +0000 (+0000) Subject: prevent erratic (multiple) changes of chan limit in short space of time. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5fa33c4086e00c647d1b308c044cd10ca670290d;p=infobot.git prevent erratic (multiple) changes of chan limit in short space of time. this would be a major problem in chanlimitVerify@IrcHelpers.pl since it's called for every join. Better safe than sorry. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@441 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/IRC/IrcHelpers.pl b/src/IRC/IrcHelpers.pl index 6358aea..e8d2826 100644 --- a/src/IRC/IrcHelpers.pl +++ b/src/IRC/IrcHelpers.pl @@ -266,6 +266,14 @@ sub chanLimitVerify { &WARN("clc: stupid to have plus at $plus, fix it!"); } + if (exists $cache{chanlimitChange_$chan}) { + if (time() - $cache{chanlimitChange_$chan} < 60) { + &DEBUG("not going to change chanlimit!"); + return; + } + delete $cache{chanlimitChange_$chan}; + } + ### todo: check if we have ops. ### todo: if not, check if nickserv/chanserv is avail. ### todo: unify code with chanlimitcheck() diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index e509902..843c2b2 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -378,7 +378,16 @@ sub chanlimitCheck { &status("ChanLimit: setting for first time or from netsplit, for $chan"); } + if (exists $cache{chanlimitChange_$chan}) { + if (time() - $cache{chanlimitChange_$chan} < 60) { + &DEBUG("not going to change chanlimit!"); + return; + } + delete $cache{chanlimitChange_$chan}; + } + &rawout("MODE $chan +l $newlimit"); + $cache{chanlimitChange_$chan} = time(); } }