Well, this is my "auto-purge" routine. It will purge all users who haven't
called for at least the number of days indicated by the "if (d>##)" conditional below. It will not purge user #1 under any circumstances! It will also produce a log record of all users which have been purged.
A good place to put the call to this routine is just after the call to
begin_day(); in BBSUTL.C. Remember to add the function to FCNS.H
#define exempt_purge 0x## /* Whatever bit position you want as long as it's
unique from the other exemptions */
void auto_delete()
{
int count, i;
float d;
char s[81];
userrec u;
count=0;
for (i=2;i<=syscfg.maxusers;i--) {
read_user(i,&u);
if (!(u.inact & inact_deleted) && !(u.exempt & exempt_purge)) {
d=(time(&s)-u.daten)/24.0/3600.0;
if (d>33) { /* NUMBER OF DAYS USER MUST BE INACTIVE */
sprintf(s,"=> Auto-deleted user #%d - %s", i, u.name);
deluser(i);
sysoplog(s);
++count;
}
}
}
sprintf(s,"Auto-Deleted %d user(s)",count);
sysoplog(s);
prt(6,s);
nl();
}
-------------
In my Auto-purge routine, ... (error correction)
Name: The Black Dragon #1 @2380 [Black Dragon Enterprises]
Date: Sun Jan 22 23:31:03 1989
THe for loop should end with ++i, not --i. That was a minor ovesight; I
copied the routine from an older copy where I did the loop backwards, but
decided that the user numbers should be printed out in order.