]> jfr.im git - irc/quakenet/newserv.git/commitdiff
cleanupglines: Only destroy glines that haven't been updated in a week.
authorGunnar Beutner <redacted>
Sun, 14 Jul 2013 09:22:01 +0000 (11:22 +0200)
committerGunnar Beutner <redacted>
Sun, 14 Jul 2013 09:22:01 +0000 (11:22 +0200)
--HG--
branch : shroudtrusts

glines/glines_commands.c

index e769e0a82ca627389dc31d1f702ebeed8aa25fa6..beadc5c2c56b2a1d20c24dc3cdc7f071e25247c4 100644 (file)
@@ -755,13 +755,16 @@ static int glines_cmdcleanupglines(void *source, int cargc, char **cargv) {
   nick *sender = source;
   gline **pnext, *gl;
   int count;
+  time_t now;
   
   count = 0;
+  time(&now);
   
   for (pnext = &glinelist; *pnext; pnext = &((*pnext)->next)) {
     gl = *pnext;
     
-    if (!(gl->flags & GLINE_ACTIVE)) {
+    /* Remove inactivate glines that have been last changed more than a week ago */
+    if (!(gl->flags & GLINE_ACTIVE) && gl->lastmod < now - 7 * 24 * 60 * 60) {
       gline_destroy(gl, 0, 1);
       count++;
     }