]> jfr.im git - solanum.git/blobdiff - extensions/invite_notify.c
extensions/invite_notify: make the NOTICE optional, configurable
[solanum.git] / extensions / invite_notify.c
index bc7c84f77ede0c07fa2054bb53004f595c208ee3..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";
@@ -13,7 +14,7 @@ static void m_invited(struct MsgBuf *, struct Client *, struct Client *, int, co
 static unsigned int CAP_INVITE_NOTIFY;
 
 mapi_hfn_list_av1 inv_notify_hfnlist[] = {
-       { "invite", hook_invite },
+       { "invite", hook_invite, HOOK_MONITOR },
        { NULL, NULL }
 };
 
@@ -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