]> jfr.im git - solanum.git/blob - extensions/no_kill_services.c
Merge pull request #53 from ShadowNinja/clarify_U+R
[solanum.git] / extensions / no_kill_services.c
1 /*
2 * Stop services kills
3 * Well, it won't stop them all, unless this is loaded on all servers.
4 *
5 * Copyright (C) 2013 Elizabeth Myers. All rights reserved.
6 * Licensed under the WTFPLv2
7 */
8
9 #include "stdinc.h"
10 #include "modules.h"
11 #include "hook.h"
12 #include "client.h"
13 #include "ircd.h"
14 #include "send.h"
15 #include "hash.h"
16 #include "s_conf.h"
17 #include "s_user.h"
18 #include "s_serv.h"
19 #include "numeric.h"
20 #include "privilege.h"
21 #include "s_newconf.h"
22
23 static void block_services_kill(void *data);
24
25 mapi_hfn_list_av1 no_kill_services_hfnlist[] = {
26 { "can_kill", (hookfn) block_services_kill },
27 { NULL, NULL }
28 };
29
30 static void
31 block_services_kill(void *vdata)
32 {
33 hook_data_client_approval *data = (hook_data_client_approval *) vdata;
34
35 if (!MyClient(data->client))
36 return;
37
38 if (!data->approved)
39 return;
40
41 if (IsService(data->target))
42 {
43 sendto_one_numeric(data->client, ERR_ISCHANSERVICE,
44 "KILL %s :Cannot kill a network service",
45 data->target->name);
46 data->approved = 0;
47 }
48 }
49
50 DECLARE_MODULE_AV1(no_kill_services, NULL, NULL, NULL, NULL,
51 no_kill_services_hfnlist, "Charybdis 3.4+");