Clean.
[seven-1.x.git] / modules / m_dehelper.c
blobd2db37813b4356505c2b5966a042b8e67a9c13e4
1 /*
2 * ircd-seven: a bovine ircd
3 * m_dehelper.c: Remove a given user from the /stats p list.
5 * Copyright (C) 2006 Stephen Bennett <spb@gentoo.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
22 * $Id: $
25 #include "stdinc.h"
26 #include "client.h"
27 #include "msg.h"
28 #include "modules.h"
29 #include "numeric.h"
30 #include "s_user.h"
31 #include "s_conf.h"
33 static int do_dehelper(struct Client *, struct Client *);
34 static int mo_dehelper(struct Client *, struct Client *, int, const char **);
35 static int me_dehelper(struct Client *, struct Client *, int, const char **);
37 struct Message dehelper_msgtab = {
38 "DEHELPER", 0, 0, 0, MFLG_SLOW,
39 {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_dehelper, 2}, {mo_dehelper, 2} }
42 mapi_clist_av1 dehelper_clist[] = { &dehelper_msgtab, NULL };
44 DECLARE_MODULE_AV1(dehelper, NULL, NULL, dehelper_clist, NULL, NULL, "$Revision: $");
46 int mo_dehelper(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
48 struct Client *target_p;
50 if (!IsOperStaffer(source_p))
51 sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "dehelper");
53 if (!(target_p = find_named_person(parv[1])))
55 sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
56 return 0;
59 if (MyClient(target_p))
60 do_dehelper(source_p, target_p);
61 else
62 sendto_one(target_p, ":%s ENCAP %s DEHELPER %s",
63 get_id(source_p, target_p), target_p->servptr->name,
64 get_id(target_p, target_p));
66 return 0;
69 int me_dehelper(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
71 struct Client *target_p = find_person(parv[1]);
72 if (MyClient(target_p))
73 do_dehelper(source_p, target_p);
75 return 0;
78 int do_dehelper(struct Client *source_p, struct Client *target_p)
80 const char *newparv[4];
82 newparv[0] = newparv[1] = target_p->name;
83 newparv[2] = "-T";
84 newparv[3] = NULL;
86 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using DEHELPER on %s",
87 get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
88 sendto_one_notice(target_p, ":%s is dehelpering you", source_p->name);
89 user_mode(target_p, target_p, 3, newparv);
90 sendto_one_notice(source_p, ":Dehelpered %s", target_p->name);
92 return 0;