]> jfr.im git - irc/rqf/shadowircd.git/blame - modules/m_unreject.c
ShadowIRCd 6.2.0-beta1
[irc/rqf/shadowircd.git] / modules / m_unreject.c
CommitLineData
212380e3 1/*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_unreject.c: Removes an ip from the reject cache
4 *
5 * Copyright (C) 2004 Aaron Sethman <androsyn@ratbox.org>
6 * Copyright (C) 2004-2005 ircd-ratbox development team
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA
22 *
212380e3 23 */
24
25#include "stdinc.h"
26#include "client.h"
27#include "s_conf.h"
28#include "hostmask.h"
29#include "reject.h"
30#include "msg.h"
31#include "modules.h"
32#include "send.h"
33
34static int mo_unreject(struct Client *, struct Client *, int, const char **);
35
36struct Message unreject_msgtab = {
37 "UNREJECT", 0, 0, 0, MFLG_SLOW,
38 {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_unreject, 2}}
39};
40
41mapi_clist_av1 unreject_clist[] = { &unreject_msgtab, NULL };
5366977b 42DECLARE_MODULE_AV1(unreject, NULL, NULL, unreject_clist, NULL, NULL, "$Revision: 3161 $");
212380e3 43
21c9d815
VY
44/*
45 * mo_unreject
46 *
47 */
48static int
49mo_unreject(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
50{
51 if(ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_ban_time == 0 ||
52 ConfigFileEntry.reject_duration == 0)
53 {
54 sendto_one_notice(source_p, ":Reject cache is disabled");
55 return 0;
56 }
57
58 if(!parse_netmask(parv[1], NULL, NULL))
59 {
60 sendto_one_notice(source_p, ":Unable to parse netmask %s", parv[1]);
61 return 0;
62 }
63
64 if(remove_reject_ip(parv[1]))
65 sendto_one_notice(source_p, ":Removed reject for %s", parv[1]);
66 else
67 sendto_one_notice(source_p, ":Unable to remove reject for %s", parv[1]);
68
69 return 0;
212380e3 70}