- if (tm.tm_hour != config.c_purge_hour) return;
- if ((now - last_purge) < 43200) return;
-
- lprintf(CTDL_INFO, "Auto-purger: starting.\n");
-
- retval = PurgeUsers();
- lprintf(CTDL_NOTICE, "Purged %d users.\n", retval);
-
- PurgeMessages();
- lprintf(CTDL_NOTICE, "Expired %d messages.\n", messages_purged);
-
- retval = PurgeRooms();
- lprintf(CTDL_NOTICE, "Expired %d rooms.\n", retval);
-
- retval = PurgeVisits();
- lprintf(CTDL_NOTICE, "Purged %d visits.\n", retval);
-
- retval = PurgeUseTable();
- lprintf(CTDL_NOTICE, "Purged %d entries from the use table.\n", retval);
-
- retval = PurgeEuidIndexTable();
- lprintf(CTDL_NOTICE, "Purged %d entries from the EUID index.\n", retval);
-
- retval = TDAP_ProcessAdjRefCountQueue();
- lprintf(CTDL_NOTICE, "Processed %d message reference count adjustments.\n", retval);
-
- lprintf(CTDL_INFO, "Auto-purger: finished.\n");
-
- last_purge = now; /* So we don't do it again soon */
-}
-
-/*****************************************************************************/
-
-
-void do_fsck_msg(long msgnum, void *userdata) {
- struct ctdlroomref *ptr;
-
- ptr = (struct ctdlroomref *)malloc(sizeof(struct ctdlroomref));
- ptr->next = rr;
- ptr->msgnum = msgnum;
- rr = ptr;
-}
-
-void do_fsck_room(struct ctdlroom *qrbuf, void *data)
-{
- getroom(&CC->room, qrbuf->QRname);
- CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, do_fsck_msg, NULL);
-}
-
-/*
- * Check message reference counts
- */
-void cmd_fsck(char *argbuf) {
- long msgnum;
- struct cdbdata *cdbmsg;
- struct MetaData smi;
- struct ctdlroomref *ptr;
- int realcount;
-
- if (CtdlAccessCheck(ac_aide)) return;
-
- /* Lame way of checking whether anyone else is doing this now */
- if (rr != NULL) {
- cprintf("%d Another FSCK is already running.\n", ERROR + RESOURCE_BUSY);