]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/permban.c
Added help to a large number of commands.
[irc/quakenet/newserv.git] / chanserv / chancmds / permban.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: permban
5 * CMDLEVEL: QCMD_AUTHED
6 * CMDARGS: 3
7 * CMDDESC: Permanently bans a hostmask on a channel.
8 * CMDFUNC: csc_dopermban
9 * CMDPROTO: int csc_dopermban(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: PERMBAN <channel> <hostmask> [<reason>]
11 * CMDHELP: Permanently bans the provided hostmask on the channel. If the ban is
12 * CMDHELP: removed from the channel e.g. by a channel op or the BANTIMER feature, the
13 * CMDHELP: ban will be reapplied if a matching user joins the channel. Bans
14 * CMDHELP: set with the PERMBAN command can be removed via BANCLEAR or BANDEL. Any users
15 * CMDHELP: matching the hostmask will be kicked from the channel.
16 * CMDHELP: Where:
17 * CMDHELP: channel - channel to set a ban on
18 * CMDHELP: hostmask - hastmask (nick!user@host) to ban.
19 * CMDHELP: reason - reason for the ban. This will be used in kick messages when kicking
20 * CMDHELP: users matching the ban. If this is not provided the generic message
21 * CMDHELP: \"Banned.\" will be used.
22 * CMDHELP: PERMBAN requires master (+m) access on the named channel.
23 */
24
25 #include "../chanserv.h"
26 #include "../../nick/nick.h"
27 #include "../../lib/flags.h"
28 #include "../../lib/irc_string.h"
29 #include "../../channel/channel.h"
30 #include "../../parser/parser.h"
31 #include "../../irc/irc.h"
32 #include "../../localuser/localuserchannel.h"
33 #include <string.h>
34 #include <stdio.h>
35
36 int csc_dopermban(void *source, int cargc, char **cargv) {
37 nick *sender=source;
38 chanindex *cip;
39 regban *rbp;
40 regchan *rcp;
41 reguser *rup=getreguserfromnick(sender);
42
43 if (cargc<2) {
44 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "permban");
45 return CMD_ERROR;
46 }
47
48 if (!(cip=cs_checkaccess(sender, cargv[0], CA_MASTERPRIV, NULL, "permban",0, 0)))
49 return CMD_ERROR;
50
51 rcp=cip->exts[chanservext];
52
53 rbp=getregban();
54 rbp->ID=++lastbanID;
55 rbp->cbp=makeban(cargv[1]);
56 rbp->setby=rup->ID;
57 rbp->expiry=0;
58 if (cargc>2)
59 rbp->reason=getsstring(cargv[2],200);
60 else
61 rbp->reason=NULL;
62 rbp->next=rcp->bans;
63 rcp->bans=rbp;
64
65 cs_setregban(cip, rbp);
66 csdb_createban(rcp, rbp);
67
68 chanservstdmessage(sender, QM_DONE);
69 return CMD_OK;
70 }