]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/usercmds/cleanupdb.c
CHANSERV: only update channels as active if they have at least one known op, and...
[irc/quakenet/newserv.git] / chanserv / usercmds / cleanupdb.c
index 273ea342145f63b23abf4035f56c1f5723f29d72..0dfb3e1052cc4b7e45cd2ba71618beaf18e66651 100644 (file)
@@ -104,6 +104,21 @@ void csu_docleanupdb_real(DBConn *dbconn, void *arg) {
       if (!(rcp=cip->exts[chanservext]))
         continue;
 
+      /* there's a bug here... if no joins or modes are done within the threshold
+       * and someone leaves just before the cleanup then the channel will be nuked.
+       */
+
+      /* this is one possible soln but relies on cleanupdb being run more frequently than
+       * the threshold:
+       */ 
+      if(cip->channel && cs_ischannelactive(cip->channel, rcp)) {
+        rcp->lastactive = t;
+        if (rcp->lastcountersync < (t - COUNTERSYNCINTERVAL)) {
+          csdb_updatechannelcounters(rcp);
+          rcp->lastcountersync=t;
+        }
+      }
+
       if(rcp->lastactive < maxchan_age) {
         /* don't remove channels with the original founder as an oper */
         founder=findreguserbyID(rcp->founder);