]>
Commit | Line | Data |
---|---|---|
7ac9dbae P |
1 | /* Automatically generated by refactor.pl. |
2 | * | |
3 | * | |
4 | * CMDNAME: cleanupdb | |
5 | * CMDLEVEL: QCMD_OPER | |
6 | * CMDARGS: 0 | |
7 | * CMDDESC: Clean Up Db | |
8 | * CMDFUNC: csu_docleanupdb | |
9 | * CMDPROTO: int csu_docleanupdb(void *source, int cargc, char **cargv); | |
10 | */ | |
11 | ||
12 | #include "../chanserv.h" | |
13 | #include "../../lib/irc_string.h" | |
14 | #include <stdio.h> | |
15 | #include <string.h> | |
16 | ||
17 | int csu_docleanupdb(void *source, int cargc, char **cargv) { | |
18 | nick *sender=source; | |
19 | reguser *vrup, *srup; | |
20 | int i; | |
21 | long to_age = 0L; | |
22 | struct tm *tmp; | |
23 | char buf[200]; | |
24 | int j = 0; | |
25 | to_age = time(NULL) - (80 * 3600 * 24); | |
26 | ||
27 | for (i=0;i<REGUSERHASHSIZE;i++) { | |
28 | for (vrup=regusernicktable[i]; vrup; vrup=srup) { | |
29 | srup=vrup->nextbyname; | |
30 | if(!vrup->nicks && vrup->lastauth < to_age && !UHasHelperPriv(vrup) && !UIsCleanupExempt(vrup)) { | |
31 | tmp=gmtime(&(vrup->lastauth)); | |
32 | strftime(buf,15,"%d/%m/%y %H:%M",tmp); | |
33 | ||
34 | cs_removeuser(vrup); | |
35 | j++; | |
36 | } | |
37 | } | |
38 | } | |
39 | ||
40 | chanservsendmessage(sender, "Removed %d Accounts (not used for 80 days)", j); | |
41 | } |