]> jfr.im git - solanum.git/blobdiff - extensions/chm_nonotice.c
Merge pull request #288 from edk0/umode-o-split
[solanum.git] / extensions / chm_nonotice.c
index ce79f081ea7998ce850ad1ffbf92ffbbd471c31f..c2dcb6b2e66f88e715932abfa68a28e300b3fd59 100644 (file)
 #include "s_serv.h"
 #include "numeric.h"
 #include "chmode.h"
+#include "messages.h"
 #include "inline/stringops.h"
 
+static const char chm_nonotice_desc[] =
+       "Adds channel mode +T which blocks notices to the channel.";
+
 static unsigned int mode_nonotice;
 
 static void chm_nonotice_process(hook_data_privmsg_channel *);
@@ -50,9 +54,11 @@ chm_nonotice_process(hook_data_privmsg_channel *data)
        if (data->approved || data->msgtype != MESSAGE_TYPE_NOTICE)
                return;
 
-       if (data->chptr.mode.mode & mode_nonotice)
+       /* block all notices except CTCPs; use chm_noctcp to block CTCPs. */
+       if (data->chptr->mode.mode & mode_nonotice && *data->text != '\001')
        {
-               data->approved = ERR_CUSTOM;
+               sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname);
+               data->approved = ERR_CANNOTSENDTOCHAN;
                return;
        }
 }
@@ -73,4 +79,4 @@ _moddeinit(void)
        cflag_orphan('T');
 }
 
-DECLARE_MODULE_AV1(chm_nonotice, _modinit, _moddeinit, NULL, NULL, chm_nonotice_hfnlist, "$Revision$");
+DECLARE_MODULE_AV2(chm_nonotice, _modinit, _moddeinit, NULL, NULL, chm_nonotice_hfnlist, NULL, NULL, chm_nonotice_desc);