]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/maillock.c
13bf6002d5b2e2a1096cfe891d23356ea92a29b5
1 /* Automatically generated by refactor.pl.
7 * CMDDESC: Set/unset/list mail lock patterns
8 * CMDFUNC: csu_domaillock
9 * CMDPROTO: int csu_domaillock(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: maillock <-list|-add|-del> <pattern> [<reason>]
11 * CMDHELP: Manipulates the list of mail lock patterns.
12 * CMDHELP: Any email address matching the pattern will be refused in HELLO/EMAIL.
13 * CMDHELP: A reason is optional for -list, but recommended.
16 #include "../chanserv.h"
17 #include "../../lib/irc_string.h"
21 int csu_domaillock(void *source
, int cargc
, char **cargv
) {
27 chanservstdmessage(sender
,QM_NOTENOUGHPARAMS
,"maillock");
33 if(!strcasecmp(cargv
[0], "-list")) {
37 chanservstdmessage(sender
, QM_MAILLOCKHEADER
);
38 for(mlp
=maillocks
;mlp
;mlp
=mlp
->next
) {
39 if(!match(mlp
->pattern
->content
, pattern
))
42 rup
=findreguserbyID(mlp
->createdby
);
43 strftime(timebuf
,15,"%d/%m/%y %H:%M",gmtime(&mlp
->created
));
45 chanservstdmessage(sender
, QM_MAILLOCKLINE
, mlp
->pattern
->content
, rup
?rup
->username
:"??", mlp
->reason
?mlp
->reason
->content
:"(none)", timebuf
);
47 } else if(!strcasecmp(cargv
[0], "-del")) {
48 maillock
*pmlp
= NULL
;
50 for(mlp
=maillocks
;mlp
;pmlp
=mlp
,mlp
=mlp
->next
)
51 if(!strcasecmp(pattern
, mlp
->pattern
->content
))
55 chanservstdmessage(sender
, QM_MAILLOCKDOESNTEXIST
);
59 csdb_deletemaillock(mlp
);
67 } else if(!strcasecmp(cargv
[0], "-add")) {
69 reguser
*rup
= getreguserfromnick(sender
);;
77 for(mlp
=maillocks
;mlp
;mlp
=mlp
->next
) {
78 if(!strcasecmp(pattern
, mlp
->pattern
->content
)) {
79 chanservstdmessage(sender
, QM_MAILLOCKALREADYEXISTS
);
85 mlp
->pattern
=getsstring(pattern
, 300);
87 mlp
->reason
=getsstring(reason
, 300);
91 mlp
->createdby
=rup
->ID
;
92 mlp
->created
=time(NULL
);
93 mlp
->id
=++lastmaillockID
;
96 csdb_createmaillock(mlp
);
99 chanservsendmessage(sender
, "Invalid option, see HELP.");
103 chanservstdmessage(sender
, QM_DONE
);