2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Remote client connect/exit notices on snomask +F (far).
|
|
|
|
* To avoid flooding, connects/exits part of netjoins/netsplits are not shown.
|
|
|
|
* Consequently, it is not possible to use these notices to keep track
|
|
|
|
* of all clients.
|
|
|
|
* -- 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 notice mask +F that allows operators to receive notices for connections on other servers";
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2016-08-22 03:57:43 +02:00
|
|
|
static void h_gcn_new_remote_user(client::client *);
|
2007-01-25 07:40:21 +01:00
|
|
|
static void h_gcn_client_exit(hook_data_client_exit *);
|
|
|
|
|
|
|
|
mapi_hfn_list_av1 gcn_hfnlist[] = {
|
|
|
|
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
|
|
|
|
{ "client_exit", (hookfn) h_gcn_client_exit },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-08-28 13:12:44 +02:00
|
|
|
sno::mode SNO_FARCONNECT { 'F' };
|
|
|
|
|
|
|
|
DECLARE_MODULE_AV2(globalconnexit, _modinit, nullptr, NULL, NULL, gcn_hfnlist, NULL, NULL, sno_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
|
|
|
/* show the fact that we are showing user information in /version */
|
2016-03-09 09:19:31 +01:00
|
|
|
opers_see_all_users = true;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-22 03:57:43 +02:00
|
|
|
h_gcn_new_remote_user(client::client *source_p)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
if (!has_sent_eob(*source_p->servptr))
|
2007-01-25 07:40:21 +01:00
|
|
|
return;
|
2016-08-28 13:12:44 +02:00
|
|
|
sendto_realops_snomask_from(SNO_FARCONNECT, L_ALL, source_p->servptr,
|
2007-01-25 07:40:21 +01:00
|
|
|
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
|
|
|
|
source_p->name, source_p->username, source_p->orighost,
|
|
|
|
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
|
|
|
|
"?", source_p->info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
h_gcn_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;
|
2016-08-23 04:33:36 +02:00
|
|
|
if (!has_sent_eob(*source_p->servptr))
|
2007-01-25 07:40:21 +01:00
|
|
|
return;
|
2016-08-28 13:12:44 +02:00
|
|
|
sendto_realops_snomask_from(SNO_FARCONNECT, L_ALL, source_p->servptr,
|
2007-01-25 07:40:21 +01:00
|
|
|
"Client exiting: %s (%s@%s) [%s] [%s]",
|
|
|
|
source_p->name,
|
|
|
|
source_p->username, source_p->host, hdata->comment,
|
|
|
|
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
|
|
|
|
}
|