home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / AUTPURG.MOD < prev    next >
Text File  |  1992-01-29  |  2KB  |  43 lines

  1. Well, this is my "auto-purge" routine.  It will purge all users who haven't
  2. 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.
  3.  
  4. A good place to put the call to this routine is just after the call to
  5. begin_day(); in BBSUTL.C.  Remember to add the function to FCNS.H
  6.  
  7. #define exempt_purge 0x##  /* Whatever bit position you want as long as it's
  8.                               unique from the other exemptions */
  9. void auto_delete()
  10. {
  11.   int count, i;
  12.   float d;
  13.   char s[81];
  14.   userrec u;
  15.  
  16.   count=0;
  17.   for (i=2;i<=syscfg.maxusers;i--) {
  18.     read_user(i,&u);
  19.     if (!(u.inact & inact_deleted) && !(u.exempt & exempt_purge)) {
  20.       d=(time(&s)-u.daten)/24.0/3600.0;
  21.       if (d>33) {             /* NUMBER OF DAYS USER MUST BE INACTIVE */
  22.         sprintf(s,"=> Auto-deleted user #%d - %s", i, u.name);
  23.         deluser(i);
  24.         sysoplog(s);
  25.         ++count;
  26.       }
  27.     }
  28.   }
  29.   sprintf(s,"Auto-Deleted %d user(s)",count);
  30.   sysoplog(s);
  31.   prt(6,s);
  32.   nl();
  33. }
  34.  
  35. -------------
  36. In my Auto-purge routine, ... (error correction)
  37. Name: The Black Dragon #1 @2380    [Black Dragon Enterprises]
  38. Date: Sun Jan 22 23:31:03 1989
  39.  
  40. THe for loop should end with ++i, not --i.  That was a minor ovesight; I 
  41. copied the routine from an older copy where I did the loop backwards, but 
  42. decided that the user numbers should be printed out in order.
  43.          The Black Dragon.