]>
Commit | Line | Data |
---|---|---|
1dd6d55d | 1 | /* Automatically generated by refactor.pl. |
2 | * | |
3 | * | |
4 | * CMDNAME: spewemail | |
5 | * CMDLEVEL: QCMD_OPER | |
6 | * CMDARGS: 1 | |
7 | * CMDDESC: Search for an e-mail in the database. | |
8 | * CMDFUNC: csu_dospewemail | |
9 | * CMDPROTO: int csu_dospewemail(void *source, int cargc, char **cargv); | |
94e4d2f4 CP |
10 | * CMDHELP: Usage: spewdb <pattern> |
11 | * CMDHELP: Displays all users with email addresses that match the supplied pattern. | |
1dd6d55d | 12 | */ |
13 | ||
14 | #include "../chanserv.h" | |
15 | #include "../../lib/irc_string.h" | |
16 | #include <stdio.h> | |
17 | #include <string.h> | |
18 | ||
19 | int csu_dospewemail(void *source, int cargc, char **cargv) { | |
20 | nick *sender=source; | |
21 | reguser *rup=getreguserfromnick(sender); | |
22 | reguser *dbrup; | |
23 | int i; | |
24 | unsigned int count=0; | |
25 | ||
26 | if (!rup) | |
27 | return CMD_ERROR; | |
28 | ||
29 | if (cargc < 1) { | |
30 | chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "spewemail"); | |
31 | return CMD_ERROR; | |
32 | } | |
33 | ||
34 | chanservstdmessage(sender, QM_SPEWHEADER); | |
35 | for (i=0;i<REGUSERHASHSIZE;i++) { | |
36 | for (dbrup=regusernicktable[i]; dbrup; dbrup=dbrup->nextbyname) { | |
37 | if (!dbrup->email) | |
38 | continue; | |
39 | if (!match(cargv[0], dbrup->email->content)) { | |
40 | chanservsendmessage(sender, "%-15s %-10s %-30s %s", dbrup->username, UHasSuspension(dbrup)?"yes":"no", dbrup->email?dbrup->email->content:"none set", dbrup->lastuserhost?dbrup->lastuserhost->content:"none"); | |
41 | count++; | |
42 | if (count >= 2000) { | |
43 | chanservstdmessage(sender, QM_TOOMANYRESULTS, 2000, "users"); | |
44 | return CMD_ERROR; | |
45 | } | |
46 | } | |
47 | } | |
48 | } | |
49 | chanservstdmessage(sender, QM_RESULTCOUNT, count, "user", (count==1)?"":"s"); | |
50 | ||
51 | return CMD_OK; | |
52 | } |