]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/clearchan.c
CHANSERV: GIVEOWNER: changed the order of checks so that trying to GIVEOWNER
[irc/quakenet/newserv.git] / chanserv / chancmds / clearchan.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: clearchan
5 * CMDLEVEL: QCMD_AUTHED
6 * CMDARGS: 1
7 * CMDDESC: Removes all modes from a channel.
8 * CMDFUNC: csc_doclearchan
9 * CMDPROTO: int csc_doclearchan(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: CLEARCHAN <channel>
11 * CMDHELP: Removes all channel modes (such as keys, limits, invite only, etc.) from
12 * CMDHELP: the named channel. Modes being enfored (see CHANMODE) will not be removed.
13 * CMDHELP: Where:
14 * CMDHELP: channel - channel to remove modes from
15 * CMDHELP: CLEARCHAN 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_doclearchan(void *source, int cargc, char **cargv) {
30 nick *sender=source;
31 regchan *rcp;
32 chanindex *cip;
33 modechanges changes;
34
35 if (cargc<1) {
36 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "clearchan");
37 return CMD_ERROR;
38 }
39
40 if (!(cip=cs_checkaccess(sender, cargv[0], CA_MASTERPRIV, NULL, "clearchan",0, 0)))
41 return CMD_ERROR;
42
43 rcp=cip->exts[chanservext];
44
45 if (cip->channel) {
46 localsetmodeinit(&changes, cip->channel, chanservnick);
47 localdosetmode_key(&changes, NULL, MCB_DEL);
48 localdosetmode_simple(&changes, 0, cip->channel->flags);
49 cs_docheckchanmodes(cip->channel, &changes);
50 localsetmodeflush(&changes, 1);
51 }
52
53 cs_log(sender,"CLEARCHAN %s",cip->name->content);
54 chanservstdmessage(sender, QM_DONE);
55 return CMD_OK;
56 }