]> jfr.im git - solanum.git/blame - extensions/no_kill_services.c
m_stats: z: remove unnecessary casting and fix format strings
[solanum.git] / extensions / no_kill_services.c
CommitLineData
9d745dbd
EM
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
3fd3d7e1
EM
23static const char nokill_desc[] = "Prevents operators from killing services";
24
9d745dbd
EM
25static void block_services_kill(void *data);
26
0ef5377a 27mapi_hfn_list_av1 no_kill_services_hfnlist[] = {
82436efb 28 { "can_kill", block_services_kill },
9d745dbd
EM
29 { NULL, NULL }
30};
31
32static void
33block_services_kill(void *vdata)
34{
35 hook_data_client_approval *data = (hook_data_client_approval *) vdata;
36
37 if (!MyClient(data->client))
38 return;
39
40 if (!data->approved)
41 return;
42
43 if (IsService(data->target))
44 {
ee456983
JT
45 sendto_one_numeric(data->client, ERR_ISCHANSERVICE,
46 "KILL %s :Cannot kill a network service",
9d745dbd
EM
47 data->target->name);
48 data->approved = 0;
49 }
50}
51
3fd3d7e1
EM
52DECLARE_MODULE_AV2(no_kill_services, NULL, NULL, NULL, NULL,
53 no_kill_services_hfnlist, NULL, NULL, nokill_desc);