]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/delchan.c
Add remaining help.
[irc/quakenet/newserv.git] / chanserv / chancmds / delchan.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: delchan
5 * CMDLEVEL: QCMD_OPER
6 * CMDARGS: 2
7 * CMDDESC: Removes a channel from the bot.
8 * CMDFUNC: csc_dodelchan
9 * CMDPROTO: int csc_dodelchan(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: delchan <channel> [<reason>]
11 * CMDHELP: Removes a channel from the bot, reason is optional.
12 */
13
14 #include "../chanserv.h"
15 #include "../../nick/nick.h"
16 #include "../../lib/flags.h"
17 #include "../../lib/irc_string.h"
18 #include "../../channel/channel.h"
19 #include "../../parser/parser.h"
20 #include "../../irc/irc.h"
21 #include "../../localuser/localuserchannel.h"
22 #include <string.h>
23 #include <stdio.h>
24
25 int csc_dodelchan(void *source, int cargc, char **cargv) {
26 nick *sender=source;
27 reguser *rup=getreguserfromnick(sender);
28 chanindex *cip;
29 regchan *rcp;
30
31 if (!rup)
32 return CMD_ERROR;
33
34 if (cargc<1) {
35 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "delchan");
36 return CMD_ERROR;
37 }
38
39 if (!(cip=findchanindex(cargv[0])) || !(rcp=cip->exts[chanservext])) {
40 chanservstdmessage(sender, QM_UNKNOWNCHAN, cargv[0]);
41 return CMD_ERROR;
42 }
43
44 cs_log(sender,"DELCHAN %s (%s)",cip->name->content,cargc>1?cargv[1]:"");
45 cs_removechannel(rcp);
46 chanservstdmessage(sender, QM_DONE);
47
48 return CMD_OK;
49 }