]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/unbanme.c
b0fcefb80dbfb869f7c1298e3e711335d2a48ae0
[irc/quakenet/newserv.git] / chanserv / chancmds / unbanme.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: unbanme
5 * CMDLEVEL: QCMD_AUTHED
6 * CMDARGS: 1
7 * CMDDESC: Removes any bans affecting you from a channel.
8 * CMDFUNC: csc_dounbanme
9 * CMDPROTO: int csc_dounbanme(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: UNBANME <channel>
11 * CMDHELP: This command removes any channel bans which affect you from a channel. It does
12 * CMDHELP: not affect persistent bans set by PERMBAN and TEMPBAN. Where:
13 * CMDHELP: channel - channel to use
14 * CMDHELP: UNBANME requires operator (+o) access on the named channel.
15 */
16
17 #include "../chanserv.h"
18 #include "../../nick/nick.h"
19 #include "../../lib/flags.h"
20 #include "../../lib/irc_string.h"
21 #include "../../channel/channel.h"
22 #include "../../parser/parser.h"
23 #include "../../irc/irc.h"
24 #include "../../localuser/localuserchannel.h"
25 #include <string.h>
26 #include <stdio.h>
27
28 int csc_dounbanme(void *source, int cargc, char **cargv) {
29 nick *sender=source;
30 chanindex *cip;
31
32 if (cargc<1) {
33 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "unbanme");
34 return CMD_ERROR;
35 }
36
37 if (!(cip=cs_checkaccess(sender, cargv[0], CA_OPPRIV, NULL, "unbanme", 0, 0)))
38 return CMD_ERROR;
39
40 /* Try to unban, if it fails we'll let the failure message speak for itself */
41 if (!cs_unbanfn(sender, cip, (UnbanFN)nickmatchban, sender, 1, 1)) {
42 chanservstdmessage(sender, QM_DONE);
43 }
44
45 cs_log(sender,"UNBANME %s",cip->name->content);
46 return CMD_OK;
47 }