]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/spewdomain.c
1 /* Automatically generated by refactor.pl.
7 * CMDDESC: Spew Mail Domains.
8 * CMDFUNC: csu_dospewdomain
9 * CMDPROTO: int csu_dospewdomain(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: spewdomain <pattern>
11 * CMDHELP: Displays all mail domains that match the specified pattern.
14 #include "../chanserv.h"
15 #include "../../lib/irc_string.h"
16 #include "../../lib/strlfunc.h"
20 int csu_dospewdomain(void *source
, int cargc
, char **cargv
) {
22 reguser
*rup
=getreguserfromnick(sender
);
26 int limit
=0, actlimit
=0;
27 char flagbuf
[100], smallbuf
[20];
33 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "spewdomain");
37 chanservstdmessage(sender
, QM_SPEWDOMAINHEADER
);
40 for (i
=0;i
<MAILDOMAINHASHSIZE
;i
++) {
41 for (mdp
=maildomainnametable
[i
]; mdp
; mdp
=mdp
->nextbyname
) {
42 if (!match(cargv
[0], mdp
->name
->content
)) {
43 limit
= 0; actlimit
=0;
44 for(smdp
=mdp
;smdp
;smdp
=smdp
->parent
) {
50 for(smdp
=mdp
;smdp
;smdp
=smdp
->parent
) {
52 actlimit
= smdp
->actlimit
;
57 snprintf(flagbuf
, sizeof(flagbuf
), "%s",printflags(mdp
->flags
, mdflags
));
59 snprintf(smallbuf
, sizeof(smallbuf
), " %d", limit
);
60 strlcat(flagbuf
, smallbuf
, sizeof(flagbuf
));
63 if(MDHasActLimit(mdp
)) {
64 snprintf(smallbuf
, sizeof(smallbuf
), " %d", actlimit
);
65 strlcat(flagbuf
, smallbuf
, sizeof(flagbuf
));
68 /***@@@ bug here? i.e. we recurse up to find limit, then check MDHaslimit for current domain only?*/
69 chanservsendmessage(sender
, "%-19s %-7d %s", mdp
->name
->content
, mdp
->count
, flagbuf
);
72 chanservstdmessage(sender
, QM_TOOMANYRESULTS
, 2000, "domains");
78 chanservstdmessage(sender
, QM_RESULTCOUNT
, count
, "domain", (count
==1)?"":"s");