]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/unbanall.c
A4STATS: remove E style escapes and switch to createtable for indices
[irc/quakenet/newserv.git] / chanserv / chancmds / unbanall.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: unbanall
5 * CMDLEVEL: QCMD_AUTHED
6 * CMDARGS: 1
7 * CMDDESC: Removes all bans from a channel.
8 * CMDFUNC: csc_dounbanall
9 * CMDPROTO: int csc_dounbanall(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: UNBANALL <channel>
11 * CMDHELP: Removes all the channel bans set on the named channel. This does not affect
12 * CMDHELP: persistent bans set via the TEMPBAN and PERMBAN commands, see BANCLEAR or
13 * CMDHELP: BANDEL for more information on removing those bans. Where:
14 * CMDHELP: channel - channel to use
15 * CMDHELP: UNBANALL requires master (+m) access on the named channel.
16 */
17
18 #include "../chanserv.h"
19 #include "../../nick/nick.h"
20 #include "../../lib/flags.h"
21 #include "../../lib/irc_string.h"
22 #include "../../channel/channel.h"
23 #include "../../parser/parser.h"
24 #include "../../irc/irc.h"
25 #include "../../localuser/localuserchannel.h"
26 #include <string.h>
27 #include <stdio.h>
28
29 int csc_dounbanall(void *source, int cargc, char **cargv) {
30 nick *sender=source;
31 chanindex *cip;
32 modechanges changes;
33
34 if (cargc<1) {
35 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "unbanall");
36 return CMD_ERROR;
37 }
38
39 if (!(cip=cs_checkaccess(sender, cargv[0], CA_MASTERPRIV, NULL, "unbanall",0, 0)))
40 return CMD_ERROR;
41
42 if (cip->channel) {
43 localsetmodeinit(&changes, cip->channel, chanservnick);
44
45 while (cip->channel->bans) {
46 localdosetmode_ban(&changes, bantostring(cip->channel->bans), MCB_DEL);
47 }
48
49 localsetmodeflush(&changes, 1);
50 }
51
52 cs_log(sender,"UNBANALL %s",cip->name->content);
53 chanservstdmessage(sender, QM_DONE);
54 return CMD_OK;
55 }