From: Jilles Tjoelker Date: Wed, 14 Mar 2012 22:04:30 +0000 (+0100) Subject: Apply colour stripping (cmode +c) to messages to @/+ channel as well. X-Git-Url: https://jfr.im/git/solanum.git/commitdiff_plain/60dd1febe20f8fc1a94973382d0ec9e0436b4ec4 Apply colour stripping (cmode +c) to messages to @/+ channel as well. --- diff --git a/modules/core/m_message.c b/modules/core/m_message.c index 7fefc764..172d4866 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -630,6 +630,7 @@ static void msg_channel_flags(int p_or_n, const char *command, struct Client *client_p, struct Client *source_p, struct Channel *chptr, int flags, const char *text) { + char text2[BUFSIZE]; int type; char c; @@ -651,6 +652,21 @@ msg_channel_flags(int p_or_n, const char *command, struct Client *client_p, source_p->localClient->last = rb_current_time(); } + if(chptr->mode.mode & MODE_NOCOLOR) + { + rb_strlcpy(text2, text, BUFSIZE); + strip_colour(text2); + text = text2; + if (EmptyString(text)) + { + /* could be empty after colour stripping and + * that would cause problems later */ + if(p_or_n != NOTICE) + sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); + return; + } + } + sendto_channel_flags(client_p, type, source_p, chptr, "%s %c%s :%s", command, c, chptr->chname, text); }