From 33a88af9f4239aa1608bc7d153431db0bf6b42c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 13 Feb 2016 10:08:42 +0100 Subject: [PATCH] ctcp: Don't bling the non-bling When stripping color codes, we currently remove any sequence of digits following ^C. As color codes use at most two digits, this means that we also remove any numbers at the start of the colored text - make sure we stop doing that and only remove digits that are actually part of a color code. https://bugs.freedesktop.org/show_bug.cgi?id=94189 --- src/idle-ctcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/idle-ctcp.c b/src/idle-ctcp.c index f282360..f28bf4b 100644 --- a/src/idle-ctcp.c +++ b/src/idle-ctcp.c @@ -98,13 +98,18 @@ gchar *idle_ctcp_kill_blingbling(const gchar *msg) { case '\x03': /* ^C */ iter++; - while (isdigit(*iter)) + /* Color codes are 1-2 digits */ + if (isdigit(*iter)) + iter++; + if (isdigit(*iter)) iter++; if (*iter == ',') { iter++; - while (isdigit(*iter)) + if (isdigit(*iter)) + iter++; + if (isdigit(*iter)) iter++; } break; -- 2.7.1