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
31 static int do_dehelper(struct Client
*, struct Client
*);
32 static int mo_dehelper(struct Client
*, struct Client
*, int, const char **);
33 static int me_dehelper(struct Client
*, struct Client
*, int, const char **);
35 struct Message dehelper_msgtab
= {
36 "DEHELPER", 0, 0, 0, MFLG_SLOW
,
37 {mg_unreg
, mg_not_oper
, mg_ignore
, mg_ignore
, {me_dehelper
, 2}, {mo_dehelper
, 2} }
40 mapi_clist_av1 dehelper_clist
[] = { &dehelper_msgtab
, NULL
};
42 DECLARE_MODULE_AV1(dehelper
, NULL
, NULL
, dehelper_clist
, NULL
, NULL
, "$Revision: $");
44 int mo_dehelper(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
46 struct Client
*target_p
;
48 if (!IsOperStaffer(source_p
))
49 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
, source_p
->name
, "dehelper");
51 if (!(target_p
= find_named_person(parv
[1])))
53 sendto_one(source_p
, form_str(ERR_NOSUCHNICK
), parv
[1]);
57 if (MyClient(target_p
))
58 do_dehelper(source_p
, target_p
);
60 sendto_one(target_p
, ":%s ENCAP %s DEHELPER %s",
61 get_id(source_p
, target_p
), target_p
->servptr
->name
,
62 get_id(target_p
, target_p
));
67 int me_dehelper(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
69 struct Client
*target_p
= find_person(parv
[1]);
70 if (MyClient(target_p
))
71 do_dehelper(source_p
, target_p
);
76 int do_dehelper(struct Client
*source_p
, struct Client
*target_p
)
78 const char *newparv
[4];
80 newparv
[0] = newparv
[1] = target_p
->name
;
84 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
, "%s is using DEHELPER on %s",
85 get_oper_name(source_p
), get_client_name(target_p
, HIDE_IP
));
86 sendto_one_notice(target_p
, ":%s is dehelpering you", source_p
->name
);
87 user_mode(target_p
, target_p
, 3, newparv
);
88 sendto_one_notice(source_p
, ":Dehelpered %s", target_p
->name
);