]> jfr.im git - solanum.git/blame - extensions/m_nokillservices.c
Include messages.h for macro form_str in select extensions
[solanum.git] / extensions / m_nokillservices.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
23static void block_services_kill(void *data);
24
25mapi_hfn_list_av1 m_nokillservices_hfnlist[] = {
26 { "can_kill", (hookfn) block_services_kill },
27 { NULL, NULL }
28};
29
30static void
31block_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_notice(data->client, ":You may not kill network service %s",
44 data->target->name);
45 data->approved = 0;
46 }
47}
48
49DECLARE_MODULE_AV1(m_nokillservices, NULL, NULL, NULL, NULL,
50 m_nokillservices_hfnlist, "Charybdis 3.4+");