Add back shared{} module flag which I managed to lose in a git-fubar...
[seven-1.x.git] / extensions / sno_globalkline.c
bloba9d8efdb2d25a70f02125f274bc6d76b87c62356
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
9 * $Id: sno_globalkline.c 62 2006-09-22 23:51:46Z spb $
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"
20 static void h_gla_client_exit(hook_data_client_exit *);
22 mapi_hfn_list_av1 gla_hfnlist[] = {
23 { "client_exit", (hookfn) h_gla_client_exit },
24 { NULL, NULL }
27 DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 62 $");
29 static void
30 h_gla_client_exit(hook_data_client_exit *hdata)
32 struct Client *source_p;
34 source_p = hdata->target;
36 if (MyConnect(source_p) || !IsClient(source_p))
37 return;
38 if (!strcmp(hdata->comment, "Bad user info"))
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);
44 else if (ConfigFileEntry.kline_reason != NULL &&
45 !strcmp(hdata->comment, ConfigFileEntry.kline_reason))
47 sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
48 "K/DLINE active for %s[%s@%s]",
49 source_p->name, source_p->username, source_p->host);