]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/bantimer.c
1 /* Automatically generated by refactor.pl.
5 * CMDLEVEL: QCMD_AUTHED
7 * CMDDESC: Shows or changes the time after which bans are removed.
8 * CMDFUNC: csc_dobantimer
9 * CMDPROTO: int csc_dobantimer(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: BANTIMER <channel> [<duration>]
11 * CMDHELP: To help keep channels clear of the clutter of too many bans, Q can automatically
12 * CMDHELP: remove channel bans after a specified time. This command is used to alter that
13 * CMDHELP: time period, disable the feature, or show the current setting, where:
14 * CMDHELP: channel - the channel to use
15 * CMDHELP: duration - how long to remove channel bans after. If duration is 0 then channel
16 * CMDHELP: bans will not be automatically removed. If duration is not specified,
17 * CMDHELP: the current setting will be displayed. Suffixes can m (minutes),
18 * CMDHELP: h (hours), d (days), w (weeks), M (months) and y (years) can be used
19 * CMDHELP: to specify the duration, for example 3d, 1w, 1h30m.
20 * CMDHELP: Viewing the current setting requires operator (+o) access on the named channel.
21 * CMDHELP: Changing the setting requires master (+m) access on the named channel.
24 #include "../chanserv.h"
25 #include "../../nick/nick.h"
26 #include "../../lib/flags.h"
27 #include "../../lib/irc_string.h"
28 #include "../../channel/channel.h"
29 #include "../../parser/parser.h"
30 #include "../../irc/irc.h"
31 #include "../../localuser/localuserchannel.h"
35 int csc_dobantimer(void *source
, int cargc
, char **cargv
) {
42 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "bantimer");
46 if (!(cip
=cs_checkaccess(sender
, cargv
[0], CA_OPPRIV
, NULL
, "bantimer",
47 QPRIV_VIEWBANTIMER
, 0)))
50 rcp
=cip
->exts
[chanservext
];
53 if (!cs_checkaccess(sender
, NULL
, CA_MASTERPRIV
, cip
, "bantimer",
54 QPRIV_CHANGEBANTIMER
, 0))
57 oldtimer
=rcp
->banduration
;
58 rcp
->banduration
=durationtolong(cargv
[1]);
60 if (rcp
->banduration
<=0) {
61 if(strcmp(cargv
[1], "0")) {
62 rcp
->banduration
=oldtimer
;
63 chanservstdmessage(sender
, QM_INVALIDDURATION2
, cargv
[1]);
70 if (rcp
->banduration
> 31622400)
71 rcp
->banduration
= 31622400;
73 csdb_updatechannel(rcp
);
75 cs_log(sender
,"BANTIMER %s %s (%u -> %lu)",cip
->name
->content
,cargv
[1],oldtimer
,rcp
->banduration
);
76 chanservstdmessage(sender
, QM_DONE
);
81 chanservstdmessage(sender
, QM_CHANBANAUTOREMOVE
, cargv
[0], longtoduration(rcp
->banduration
, 1));
83 chanservstdmessage(sender
, QM_NOCHANBANAUTOREMOVE
, cargv
[0]);