]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Update "last used" value for channel if a user auths while in it and it is
authorsplidge <redacted>
Tue, 25 Mar 2008 01:20:17 +0000 (01:20 +0000)
committersplidge <redacted>
Tue, 25 Mar 2008 01:20:17 +0000 (01:20 +0000)
large enough.  Avoids losing channels where all the users join before they
auth.

chanserv/chanservuser.c

index 2bebc20c48dcf90bbaf924232158f041c7ce735f..9f31209862a665bb55f870465dad1bd806ab5390 100644 (file)
@@ -728,6 +728,17 @@ void cs_doallautomodes(nick *np) {
       if ((lp=getnumerichandlefromchanhash(rcup->chan->index->channel->users, np->numeric))) {
         /* User is on channel.. */
 
+        if (CUKnown(rcup) && rcup->chan->index->channel->users->totalusers >= 3) {
+          /* This meets the channel use criteria, update. */
+          rcup->chan->lastactive=time(NULL);
+          
+          /* Don't spam the DB though for channels with lots of joins */
+          if (rcup->chan->lastcountersync < (time(NULL) - COUNTERSYNCINTERVAL)) {
+            csdb_updatechannelcounters(rcup->chan);
+            rcup->chan->lastcountersync=time(NULL);
+          }
+        }
+
         /* Update last use time */
         rcup->usetime=getnettime();