From d22a2a20f08d9ba8bf3da112c8bace9da726f8db Mon Sep 17 00:00:00 2001 From: i Date: Sun, 14 Jul 2019 19:01:31 +0300 Subject: [PATCH] Make usermode +T block channel CTCP's as well. --- include/struct.h | 1 + src/modules/m_message.c | 3 +++ src/send.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/include/struct.h b/include/struct.h index 4db018292..0c79a5ba2 100644 --- a/include/struct.h +++ b/include/struct.h @@ -1940,6 +1940,7 @@ struct _configitem_badword { #define SEND_REMOTE 0x2 #define SEND_ALL (SEND_LOCAL|SEND_REMOTE) #define SKIP_DEAF 0x4 +#define SKIP_CTCP 0x8 #endif /* __struct_include__ */ diff --git a/src/modules/m_message.c b/src/modules/m_message.c index 641e65f10..d3047b8b1 100644 --- a/src/modules/m_message.c +++ b/src/modules/m_message.c @@ -344,6 +344,9 @@ int m_message(aClient *cptr, aClient *sptr, MessageTag *recv_mtags, int parc, ch if (!strchr(CHANCMDPFX,parv[2][0])) sendflags |= SKIP_DEAF; + if ((*parv[2] == '\001') && strncmp(&parv[2][1], "ACTION ", 7)) + sendflags |= SKIP_CTCP; + text = parv[2]; if (MyClient(sptr)) diff --git a/src/send.c b/src/send.c index 34705f018..323d10cde 100644 --- a/src/send.c +++ b/src/send.c @@ -375,6 +375,9 @@ void sendto_channel(aChannel *chptr, aClient *from, aClient *skip, /* Don't send to deaf clients (unless 'senddeaf' is set) */ if (IsDeaf(acptr) && (sendflags & SKIP_DEAF)) continue; + /* Don't send to NOCTCP clients */ + if (has_user_mode(acptr, 'T') && (sendflags & SKIP_CTCP)) + continue; /* Now deal with 'prefix' (if non-zero) */ if (!prefix) goto good;