]> jfr.im git - solanum.git/commitdiff
Apply colour stripping (cmode +c) to messages to @/+ channel as well.
authorJilles Tjoelker <redacted>
Wed, 14 Mar 2012 22:04:30 +0000 (23:04 +0100)
committerJilles Tjoelker <redacted>
Wed, 14 Mar 2012 22:04:30 +0000 (23:04 +0100)
modules/core/m_message.c

index 7fefc76403d0b1cd35fbc20b01a8c74203d7b838..172d486683cc5083635d6467117514c4bce2ec68 100644 (file)
@@ -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);
 }