]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/unbanmask.c
f2607850c09f4c6bf7d72d1a74f836e1a016cfdd
[irc/quakenet/newserv.git] / chanserv / chancmds / unbanmask.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: unbanmask
5 * CMDLEVEL: QCMD_AUTHED
6 * CMDARGS: 2
7 * CMDDESC: Removes bans matching a particular mask from a channel.
8 * CMDFUNC: csc_dounbanmask
9 * CMDPROTO: int csc_dounbanmask(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: UNBANMASK <channel> <mask>
11 * CMDHELP: Removes any bans on the channel which are overlapped by the named mask. Can
12 * CMDHELP: remove both channel bans and registered bans. Where:
13 * CMDHELP: channel - channel to use
14 * CMDHELP: mask - mask to remove. Any ban subsumed by this mask will be removed. For
15 * CMDHELP: example, UNBANMASK *!*@*.isp.net would remove *!*@host1.isp.net and
16 * CMDHELP: *!*@host2.isp.net and *!user@*.isp.net.
17 * CMDHELP: UNBANMASK requires operator (+o) access on the named channel.
18 * CMDHELP: Removing registered bans requires master (+m) access on the named channel.
19 */
20
21 #include "../chanserv.h"
22 #include "../../nick/nick.h"
23 #include "../../lib/flags.h"
24 #include "../../lib/irc_string.h"
25 #include "../../channel/channel.h"
26 #include "../../parser/parser.h"
27 #include "../../irc/irc.h"
28 #include "../../localuser/localuserchannel.h"
29 #include <string.h>
30 #include <stdio.h>
31
32 int csc_dounbanmask(void *source, int cargc, char **cargv) {
33 nick *sender=source;
34 chanindex *cip;
35 struct chanban *theban;
36
37 if (cargc<2) {
38 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "unbanmask");
39 return CMD_ERROR;
40 }
41
42 if (!(cip=cs_checkaccess(sender, cargv[0], CA_OPPRIV, NULL, "unbanmask", 0, 0)))
43 return CMD_ERROR;
44
45 theban=makeban(cargv[1]);
46 /* nice cast here */
47 cs_unbanfn(sender, cip, (UnbanFN)banoverlap, theban, 1, 0);
48 cs_log(sender,"UNBANMASK %s",bantostring(theban));
49 freechanban(theban);
50
51 chanservstdmessage(sender, QM_DONE);
52 return CMD_OK;
53 }