2007-01-25 06:40:21 +00: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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "hook.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
#include "send.h"
|
|
|
|
#include "s_conf.h"
|
|
|
|
#include "snomask.h"
|
|
|
|
|
2016-03-09 07:29:41 +00: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 06:40:21 +00:00
|
|
|
static int _modinit(void);
|
|
|
|
static void _moddeinit(void);
|
2021-08-20 03:09:40 +00:00
|
|
|
static void h_gcn_new_remote_user(void *);
|
|
|
|
static void h_gcn_client_exit(void *);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
mapi_hfn_list_av1 gcn_hfnlist[] = {
|
2021-08-20 03:09:40 +00:00
|
|
|
{ "new_remote_user", h_gcn_new_remote_user },
|
|
|
|
{ "client_exit", h_gcn_client_exit },
|
2007-01-25 06:40:21 +00:00
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-03-07 10:02:27 +00:00
|
|
|
DECLARE_MODULE_AV2(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, NULL, NULL, sno_desc);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
|
|
|
/* add the snomask to the available slot */
|
|
|
|
snomask_modes['F'] = find_snomask_slot();
|
|
|
|
|
|
|
|
/* show the fact that we are showing user information in /version */
|
2016-03-09 08:19:31 +00:00
|
|
|
opers_see_all_users = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
|
|
|
/* disable the snomask and remove it from the available list */
|
|
|
|
snomask_modes['F'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-08-20 03:09:40 +00:00
|
|
|
h_gcn_new_remote_user(void *data)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2021-08-20 03:09:40 +00:00
|
|
|
struct Client *source_p = data;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if (!HasSentEob(source_p->servptr))
|
|
|
|
return;
|
|
|
|
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
2021-06-12 18:30:50 +00:00
|
|
|
"Client connecting: %s (%s@%s) [%s] {%s} <%s> [%s]",
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->name, source_p->username, source_p->orighost,
|
|
|
|
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
|
2021-06-12 18:30:50 +00:00
|
|
|
"?", *source_p->user->suser ? source_p->user->suser : "*",
|
|
|
|
source_p->info);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-08-20 03:09:40 +00:00
|
|
|
h_gcn_client_exit(void *data)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2021-08-20 03:09:40 +00:00
|
|
|
hook_data_client_exit *hdata = data;
|
2007-01-25 06:40:21 +00:00
|
|
|
struct Client *source_p;
|
|
|
|
|
|
|
|
source_p = hdata->target;
|
|
|
|
|
|
|
|
if (MyConnect(source_p) || !IsClient(source_p))
|
|
|
|
return;
|
|
|
|
if (!HasSentEob(source_p->servptr))
|
|
|
|
return;
|
|
|
|
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
|
|
|
"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");
|
|
|
|
}
|