extensions/invite_notify: make the NOTICE optional, configurable

This adds a configuration option that determines whether the NOTICE is
sent to clients that do not support the IRCv3 invite-notify capability.

Requested by LiberaChat MGM.
This commit is contained in:
Aaron Jones 2023-01-11 21:16:58 +00:00 committed by Stephen Bennett
parent 642c73dddb
commit 4d12e65469
7 changed files with 23 additions and 4 deletions

View file

@ -371,6 +371,7 @@ channel {
displayed_usercount = 3; displayed_usercount = 3;
strip_topic_colors = no; strip_topic_colors = no;
opmod_send_statusmsg = no; opmod_send_statusmsg = no;
invite_notify_notice = yes;
}; };
serverhide { serverhide {

View file

@ -815,6 +815,11 @@ channel {
/* ip_bans_through_vhost: should channel IP bans see through dynamic spoofed hosts? */ /* ip_bans_through_vhost: should channel IP bans see through dynamic spoofed hosts? */
ip_bans_through_vhost = yes; ip_bans_through_vhost = yes;
/* invite_notify_notice: when using extensions/invite_notify, should
* we send a NOTICE to clients that don't support IRCv3 invite-notify
*/
invite_notify_notice = yes;
}; };

View file

@ -4,6 +4,7 @@
#include <client.h> #include <client.h>
#include <hash.h> #include <hash.h>
#include <send.h> #include <send.h>
#include <s_conf.h>
#include <s_serv.h> #include <s_serv.h>
static const char inv_notify_desc[] = "Notifies channel on /invite and provides the invite-notify client capability"; static const char inv_notify_desc[] = "Notifies channel on /invite and provides the invite-notify client capability";
@ -32,12 +33,16 @@ mapi_clist_av1 inv_notify_clist[] = { &invited_msgtab, NULL };
static void static void
invite_notify(struct Client *source, struct Client *target, struct Channel *channel) invite_notify(struct Client *source, struct Client *target, struct Channel *channel)
{ {
sendto_channel_local_with_capability(source, CHFL_CHANOP, 0, CAP_INVITE_NOTIFY, channel,
":%s NOTICE %s :%s is inviting %s to %s.",
me.name, channel->chname, source->name, target->name, channel->chname);
sendto_channel_local_with_capability(source, CHFL_CHANOP, CAP_INVITE_NOTIFY, 0, channel, sendto_channel_local_with_capability(source, CHFL_CHANOP, CAP_INVITE_NOTIFY, 0, channel,
":%s!%s@%s INVITE %s %s", source->name, source->username, ":%s!%s@%s INVITE %s %s", source->name, source->username,
source->host, target->name, channel->chname); source->host, target->name, channel->chname);
if (!ConfigChannel.invite_notify_notice)
return;
sendto_channel_local_with_capability(source, CHFL_CHANOP, 0, CAP_INVITE_NOTIFY, channel,
":%s NOTICE %s :%s is inviting %s to %s.",
me.name, channel->chname, source->name, target->name, channel->chname);
} }
static void static void

View file

@ -297,6 +297,7 @@ struct config_channel_entry
int strip_topic_colors; int strip_topic_colors;
int opmod_send_statusmsg; int opmod_send_statusmsg;
int ip_bans_through_vhost; int ip_bans_through_vhost;
int invite_notify_notice;
}; };
struct config_server_hide struct config_server_hide

View file

@ -2821,6 +2821,7 @@ static struct ConfEntry conf_channel_table[] =
{ "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors }, { "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors },
{ "opmod_send_statusmsg", CF_YESNO, NULL, 0, &ConfigChannel.opmod_send_statusmsg }, { "opmod_send_statusmsg", CF_YESNO, NULL, 0, &ConfigChannel.opmod_send_statusmsg },
{ "ip_bans_through_vhost", CF_YESNO, NULL, 0, &ConfigChannel.ip_bans_through_vhost }, { "ip_bans_through_vhost", CF_YESNO, NULL, 0, &ConfigChannel.ip_bans_through_vhost },
{ "invite_notify_notice", CF_YESNO, NULL, 0, &ConfigChannel.invite_notify_notice },
{ "\0", 0, NULL, 0, NULL } { "\0", 0, NULL, 0, NULL }
}; };

View file

@ -829,7 +829,8 @@ set_default_conf(void)
ConfigChannel.disable_local_channels = false; ConfigChannel.disable_local_channels = false;
ConfigChannel.displayed_usercount = 3; ConfigChannel.displayed_usercount = 3;
ConfigChannel.opmod_send_statusmsg = false; ConfigChannel.opmod_send_statusmsg = false;
ConfigChannel.ip_bans_through_vhost= true; ConfigChannel.ip_bans_through_vhost = true;
ConfigChannel.invite_notify_notice = true;
ConfigChannel.autochanmodes = MODE_TOPICLIMIT | MODE_NOPRIVMSGS; ConfigChannel.autochanmodes = MODE_TOPICLIMIT | MODE_NOPRIVMSGS;

View file

@ -636,6 +636,11 @@ static struct InfoStruct info_table[] = {
"Channel IP bans see through dynamic spoofs", "Channel IP bans see through dynamic spoofs",
INFO_INTBOOL_YN(&ConfigChannel.ip_bans_through_vhost), INFO_INTBOOL_YN(&ConfigChannel.ip_bans_through_vhost),
}, },
{
"invite_notify_notice",
"NOTICEs are sent to clients that do not support invite-notify",
INFO_INTBOOL_YN(&ConfigChannel.invite_notify_notice),
},
{ {
"hide_opers", "hide_opers",
"Hide all opers from unprivileged users", "Hide all opers from unprivileged users",