]> jfr.im git - solanum.git/commitdiff
extensions/invite_notify: make the NOTICE optional, configurable
authorAaron Jones <redacted>
Wed, 11 Jan 2023 21:16:58 +0000 (21:16 +0000)
committerStephen Bennett <redacted>
Wed, 8 Nov 2023 13:12:49 +0000 (13:12 +0000)
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.

doc/ircd.conf.example
doc/reference.conf
extensions/invite_notify.c
include/s_conf.h
ircd/newconf.c
ircd/s_conf.c
modules/m_info.c

index ff3f549d6c2528729c1ec367e12071a90c9628f4..a3c03984cfaf3a0f4349dfd95bfa21d26c3ec097 100644 (file)
@@ -371,6 +371,7 @@ channel {
        displayed_usercount = 3;
        strip_topic_colors = no;
        opmod_send_statusmsg = no;
+       invite_notify_notice = yes;
 };
 
 serverhide {
index 58b5fed1f8696045e9d96af192c3cd6367e82893..b6eda7fdee5785ec9ae119ceede4564246696705 100644 (file)
@@ -815,6 +815,11 @@ channel {
 
        /* ip_bans_through_vhost: should channel IP bans see through dynamic spoofed hosts? */
        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;
 };
 
 
index 19708f90cdd1b3946e961b816f9703b581a216a6..96e13f6803511b88cce611519dac37553a7acd34 100644 (file)
@@ -4,6 +4,7 @@
 #include <client.h>
 #include <hash.h>
 #include <send.h>
+#include <s_conf.h>
 #include <s_serv.h>
 
 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
 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,
                ":%s!%s@%s INVITE %s %s", source->name, source->username,
                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
index 53233ee1cda4408ff879f5d6da49b08467d17dad..cd50de438b4624d23b3986e6dcb2a13a9e9efbb6 100644 (file)
@@ -297,6 +297,7 @@ struct config_channel_entry
        int strip_topic_colors;
        int opmod_send_statusmsg;
        int ip_bans_through_vhost;
+       int invite_notify_notice;
 };
 
 struct config_server_hide
index 33bfd4d1a6c73bbc11f09e2a1ff5c8e8f4dce4d8..55a474d4fe3f4d59fb0e31f8b73896399996137b 100644 (file)
@@ -2821,6 +2821,7 @@ static struct ConfEntry conf_channel_table[] =
        { "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors    },
        { "opmod_send_statusmsg", CF_YESNO, NULL, 0, &ConfigChannel.opmod_send_statusmsg        },
        { "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 }
 };
 
index dadaf7a41e960a284e3d882665bcf2390caa4150..87f18785caa6bedbaf5abb1e242cc7b6b82aca34 100644 (file)
@@ -829,7 +829,8 @@ set_default_conf(void)
        ConfigChannel.disable_local_channels = false;
        ConfigChannel.displayed_usercount = 3;
        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;
 
index 6742bafb1749b971c28dd4dfcae5d6b5854a42c3..c2096c4ee464e1e4df1badaf6981960f43459957 100644 (file)
@@ -636,6 +636,11 @@ static struct InfoStruct info_table[] = {
                "Channel IP bans see through dynamic spoofs",
                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 all opers from unprivileged users",