]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/sno_globalkline.c
aclocal is unneeded here.
[irc/rqf/shadowircd.git] / extensions / sno_globalkline.c
CommitLineData
212380e3 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
8 *
9 * $Id: sno_globalkline.c 613 2006-01-29 03:03:02Z nenolod $
10 */
11
12#include "stdinc.h"
13#include "modules.h"
14#include "client.h"
15#include "hook.h"
16#include "ircd.h"
17#include "send.h"
18#include "s_conf.h"
19
20static void h_gla_client_exit(hook_data_client_exit *);
21
22mapi_hfn_list_av1 gla_hfnlist[] = {
23 { "client_exit", (hookfn) h_gla_client_exit },
24 { NULL, NULL }
25};
26
27DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 613 $");
28
29static void
30h_gla_client_exit(hook_data_client_exit *hdata)
31{
32 struct Client *source_p;
33
34 source_p = hdata->target;
35
36 if (MyConnect(source_p) || !IsClient(source_p))
37 return;
38 if (!strcmp(hdata->comment, "Bad user info"))
39 {
40 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
41 "XLINE active for %s[%s@%s]",
42 source_p->name, source_p->username, source_p->host);
43 }
44 else if (ConfigFileEntry.kline_reason != NULL &&
45 !strcmp(hdata->comment, ConfigFileEntry.kline_reason))
46 {
47 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
d5a432fa 48 "K/DLINE active for %s[%s@%s]",
212380e3 49 source_p->name, source_p->username, source_p->host);
50 }
1f24b3b1
JT
51 else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
52 {
53 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
54 "K/DLINE active for %s[%s@%s]",
55 source_p->name, source_p->username, source_p->host);
56 }
57 else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
58 {
59 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
60 "K/DLINE active for %s[%s@%s]",
61 source_p->name, source_p->username, source_p->host);
62 }
212380e3 63}