]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/chanservuser.c
(hopefully) restored old autolimit semantics.
[irc/quakenet/newserv.git] / chanserv / chanservuser.c
index 5c92824a61aab3412012e775d1927a728fce4a96..2bebc20c48dcf90bbaf924232158f041c7ce735f 100644 (file)
@@ -916,9 +916,14 @@ void cs_timerfunc(void *arg) {
   
   if (CIsAutoLimit(rcp)) {
     if (!rcp->limit || rcp->autoupdate <= now) {
-      /* Update limit.. */
-      rcp->limit=cp->users->totalusers+rcp->autolimit;
-      rcp->status |= QCSTAT_MODECHECK;
+      /* Only update the limit if there are <= (autolimit/2) or 
+       * >= (autolimit * 1.5) slots free */
+      
+      if ((cp->users->totalusers >= (rcp->limit - rcp->autolimit/2)) ||
+          (cp->users->totalusers <= (rcp->limit - (3 * rcp->autolimit)/2))) {
+        rcp->limit=cp->users->totalusers+rcp->autolimit;
+        rcp->status |= QCSTAT_MODECHECK;
+      }
       
       /* And set the schedule for the next update */
       rcp->autoupdate = now + AUTOLIMIT_INTERVAL;