X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/359407245dc405be576c30d74d0f0234142b4ddf..9dd128b4da6e54ca9f97cfcd48e345a57790ffbe:/extensions/chm_nonotice.c diff --git a/extensions/chm_nonotice.c b/extensions/chm_nonotice.c index ce79f081..c2dcb6b2 100644 --- a/extensions/chm_nonotice.c +++ b/extensions/chm_nonotice.c @@ -32,8 +32,12 @@ #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);