]> jfr.im git - solanum.git/blame - extensions/sno_globalkline.c
modules: Add AV2 descriptions to all m_u* modules
[solanum.git] / extensions / sno_globalkline.c
CommitLineData
212380e3
AC
1/*
2 * Shows notices if remote clients exit with "Bad user info" or
3 * ConfigFileEntry.kline_reason.
4 * Assumes client_exit is enabled so users can't fake these reasons,
5 * and kline_reason is enabled and the same everywhere.
6 * Yes, this is a hack, but it is simple and avoids sending
7 * more data across servers -- jilles
212380e3
AC
8 */
9
10#include "stdinc.h"
11#include "modules.h"
12#include "client.h"
13#include "hook.h"
14#include "ircd.h"
15#include "send.h"
16#include "s_conf.h"
17
18static void h_gla_client_exit(hook_data_client_exit *);
19
20mapi_hfn_list_av1 gla_hfnlist[] = {
21 { "client_exit", (hookfn) h_gla_client_exit },
22 { NULL, NULL }
23};
24
04f832b7 25DECLARE_MODULE_AV2(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, NULL, NULL, NULL);
212380e3
AC
26
27static void
28h_gla_client_exit(hook_data_client_exit *hdata)
29{
30 struct Client *source_p;
31
32 source_p = hdata->target;
33
34 if (MyConnect(source_p) || !IsClient(source_p))
35 return;
36 if (!strcmp(hdata->comment, "Bad user info"))
37 {
38 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
39 "XLINE active for %s[%s@%s]",
40 source_p->name, source_p->username, source_p->host);
41 }
42 else if (ConfigFileEntry.kline_reason != NULL &&
43 !strcmp(hdata->comment, ConfigFileEntry.kline_reason))
44 {
45 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
170703fe 46 "K/DLINE active for %s[%s@%s]",
212380e3
AC
47 source_p->name, source_p->username, source_p->host);
48 }
fb47b366
JT
49 else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
50 {
51 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
52 "K/DLINE active for %s[%s@%s]",
53 source_p->name, source_p->username, source_p->host);
54 }
55 else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
56 {
57 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
58 "K/DLINE active for %s[%s@%s]",
59 source_p->name, source_p->username, source_p->host);
60 }
212380e3 61}