0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-12 13:01:07 +01:00

extensions: Apply mode_lease to snomask extensions.

This commit is contained in:
Jason Volk 2016-08-28 04:12:44 -07:00
parent e052b0ed06
commit 3589a763e8
3 changed files with 13 additions and 37 deletions

View file

@ -8,7 +8,6 @@ static const char sno_desc[] =
"Adds server notice mask +l that allows operators to receive channel creation notices";
static int _modinit(void);
static void _moddeinit(void);
static void h_scc_channel_join(void *);
mapi_hfn_list_av1 scc_hfnlist[] = {
@ -16,25 +15,16 @@ mapi_hfn_list_av1 scc_hfnlist[] = {
{ NULL, NULL }
};
DECLARE_MODULE_AV2(sno_channelcreate, _modinit, _moddeinit, NULL, NULL, scc_hfnlist, NULL, NULL, sno_desc);
sno::mode SNO_CHANNELCREATE { 'l' };
DECLARE_MODULE_AV2(sno_channelcreate, _modinit, nullptr, NULL, NULL, scc_hfnlist, NULL, NULL, sno_desc);
static int
_modinit(void)
{
/* add the snomask to the available slot */
sno::table['l'] = sno::mask(find_slot(sno::table));
return 0;
}
static void
_moddeinit(void)
{
/* disable the snomask and remove it from the available list */
sno::table['l'] = sno::mask(0);
}
static void
h_scc_channel_join(void *vdata)
{
@ -45,7 +35,7 @@ h_scc_channel_join(void *vdata)
/* If they just joined a channel, and it only has one member, then they just created it. */
if(size(chptr->members) == 1 && is_chanop(get(chptr->members, *source_p, std::nothrow)))
{
sendto_realops_snomask(sno::table['l'], L_NETWIDE, "%s is creating new channel %s",
sendto_realops_snomask(SNO_CHANNELCREATE, L_NETWIDE, "%s is creating new channel %s",
source_p->name, chptr->name.c_str());
}
}

View file

@ -22,34 +22,26 @@ mapi_hfn_list_av1 gcn_hfnlist[] = {
{ NULL, NULL }
};
DECLARE_MODULE_AV2(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, NULL, NULL, sno_desc);
sno::mode SNO_FARCONNECT { 'F' };
DECLARE_MODULE_AV2(globalconnexit, _modinit, nullptr, NULL, NULL, gcn_hfnlist, NULL, NULL, sno_desc);
static int
_modinit(void)
{
/* add the snomask to the available slot */
sno::table['F'] = sno::mask(find_slot(sno::table));
/* show the fact that we are showing user information in /version */
opers_see_all_users = true;
return 0;
}
static void
_moddeinit(void)
{
/* disable the snomask and remove it from the available list */
sno::table['F'] = sno::mask(0);
}
static void
h_gcn_new_remote_user(client::client *source_p)
{
if (!has_sent_eob(*source_p->servptr))
return;
sendto_realops_snomask_from(sno::table['F'], L_ALL, source_p->servptr,
sendto_realops_snomask_from(SNO_FARCONNECT, L_ALL, source_p->servptr,
"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",
@ -67,7 +59,7 @@ h_gcn_client_exit(hook_data_client_exit *hdata)
return;
if (!has_sent_eob(*source_p->servptr))
return;
sendto_realops_snomask_from(sno::table['F'], L_ALL, source_p->servptr,
sendto_realops_snomask_from(SNO_FARCONNECT, L_ALL, source_p->servptr,
"Client exiting: %s (%s@%s) [%s] [%s]",
source_p->name,
source_p->username, source_p->host, hdata->comment,

View file

@ -28,21 +28,15 @@ mapi_hfn_list_av1 whois_hfnlist[] = {
{NULL, NULL}
};
sno::mode SNO_WHOIS { 'W' };
static int
init(void)
{
sno::table['W'] = sno::mask(find_slot(sno::table));
return 0;
}
static void
fini(void)
{
sno::table['W'] = sno::mask(0);
}
DECLARE_MODULE_AV2(sno_whois, init, fini, NULL, NULL, whois_hfnlist, NULL, NULL, sno_desc);
DECLARE_MODULE_AV2(sno_whois, init, nullptr, NULL, NULL, whois_hfnlist, NULL, NULL, sno_desc);
void
show_whois(hook_data_client *data)
@ -55,7 +49,7 @@ show_whois(hook_data_client *data)
is(*target_p, umode::OPER) &&
#endif
(source_p != target_p) &&
(target_p->snomask & sno::table['W']))
(target_p->snomask & SNO_WHOIS))
{
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",