Now the autopurger will always attempt to purge users regardless of the
authorDave West <davew@uncensored.citadel.org>
Tue, 15 Jan 2008 14:15:06 +0000 (14:15 +0000)
committerDave West <davew@uncensored.citadel.org>
Tue, 15 Jan 2008 14:15:06 +0000 (14:15 +0000)
"Default user purge time" but it will not purge users on time if it is
disabled.
This change added so that dead users are removed if need be.

Check this out guys. The changes are simple but lots of possible things
to test with catastrophic results if I got it wrong.

This should mean that users that have been deleted but not purged and
users that want to be deleted get deleted even if the user purge is
turned off.

Only deleteing users based on time is disabled if the user purge is
0.

citadel/modules/expire/serv_expire.c

index eaff4280b9831e6ebcb1da5efc345e70180a0bc0..96569d7a1d1f4b524a455954c1372b013e29a190 100644 (file)
@@ -403,16 +403,14 @@ void do_user_purge(struct ctdluser *us, void *data) {
        /* The default rule is to not purge. */
        purge = 0;
 
-       /* If the user hasn't called in two months, his/her account
+       /* If the user hasn't called in two months and expiring of accounts is turned on, his/her account
         * has expired, so purge the record.
         */
-       now = time(NULL);
-       if ((now - us->lastcall) > purge_time) purge = 1;
-
-       /* If the user set his/her password to 'deleteme', he/she
-        * wishes to be deleted, so purge the record.
-        */
-       if (!strcasecmp(us->password, "deleteme")) purge = 1;
+       if (config.c_userpurge > 0)
+       {
+               now = time(NULL);
+               if ((now - us->lastcall) > purge_time) purge = 1;
+       }
 
        /* If the record is marked as permanent, don't purge it.
         */
@@ -428,6 +426,12 @@ void do_user_purge(struct ctdluser *us, void *data) {
         */
        if (us->axlevel == 0) purge = 1;
 
+       /* If the user set his/her password to 'deleteme', he/she
+        * wishes to be deleted, so purge the record.
+        * Moved this lower down so that aides and permanent users get purged if they ask to be.
+        */
+       if (!strcasecmp(us->password, "deleteme")) purge = 1;
+       
        /* 0 calls is impossible.  If there are 0 calls, it must
         * be a corrupted record, so purge it.
         */
@@ -462,9 +466,7 @@ int PurgeUsers(void) {
 
        switch(config.c_auth_mode) {
                case AUTHMODE_NATIVE:
-                       if (config.c_userpurge > 0) {
-                               ForEachUser(do_user_purge, NULL);
-                       }
+                       ForEachUser(do_user_purge, NULL);
                        break;
                case AUTHMODE_HOST:
                        ForEachUser(do_uid_user_purge, NULL);