2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Shows notices if remote clients exit with "Bad user info" or
|
|
|
|
* ConfigFileEntry.kline_reason.
|
|
|
|
* Assumes client_exit is enabled so users can't fake these reasons,
|
|
|
|
* and kline_reason is enabled and the same everywhere.
|
|
|
|
* Yes, this is a hack, but it is simple and avoids sending
|
|
|
|
* more data across servers -- jilles
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char sno_desc[] =
|
|
|
|
"Adds server notices for global XLINEs, KLINEs, and DLINEs";
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static void h_gla_client_exit(hook_data_client_exit *);
|
|
|
|
|
|
|
|
mapi_hfn_list_av1 gla_hfnlist[] = {
|
|
|
|
{ "client_exit", (hookfn) h_gla_client_exit },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-03-07 11:11:51 +01:00
|
|
|
DECLARE_MODULE_AV2(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, NULL, NULL, sno_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
h_gla_client_exit(hook_data_client_exit *hdata)
|
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *source_p;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
source_p = hdata->target;
|
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
if (my_connect(*source_p) || !is_client(*source_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
return;
|
|
|
|
if (!strcmp(hdata->comment, "Bad user info"))
|
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask_from(sno::GENERAL, L_ALL, source_p->servptr,
|
2007-01-25 07:40:21 +01:00
|
|
|
"XLINE active for %s[%s@%s]",
|
|
|
|
source_p->name, source_p->username, source_p->host);
|
|
|
|
}
|
|
|
|
else if (ConfigFileEntry.kline_reason != NULL &&
|
|
|
|
!strcmp(hdata->comment, ConfigFileEntry.kline_reason))
|
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask_from(sno::GENERAL, L_ALL, source_p->servptr,
|
2008-04-11 16:47:03 +02:00
|
|
|
"K/DLINE active for %s[%s@%s]",
|
2007-01-25 07:40:21 +01:00
|
|
|
source_p->name, source_p->username, source_p->host);
|
|
|
|
}
|
2008-09-17 00:24:50 +02:00
|
|
|
else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
|
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask_from(sno::GENERAL, L_ALL, source_p->servptr,
|
2008-09-17 00:24:50 +02:00
|
|
|
"K/DLINE active for %s[%s@%s]",
|
|
|
|
source_p->name, source_p->username, source_p->host);
|
|
|
|
}
|
|
|
|
else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
|
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask_from(sno::GENERAL, L_ALL, source_p->servptr,
|
2008-09-17 00:24:50 +02:00
|
|
|
"K/DLINE active for %s[%s@%s]",
|
|
|
|
source_p->name, source_p->username, source_p->host);
|
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|