summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2016-02-13 10:08:42 +0100
committerDebarshi Ray <debarshir@gnome.org>2016-02-25 16:27:44 +0100
commitcf646c5c0d8a47ae15e4ecbea015b75c56eea4a0 (patch)
treed862509f1bcb3e0e91b2a3d542df3bb2712febfd
parent12211654baa75db13a05b5c2b3293d1378fcf7a2 (diff)
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
-rw-r--r--src/idle-ctcp.c9
1 files 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;