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:59:32 +0100
commitbf6d596e40e5b9426a68dcd22aa62a697457c4f7 (patch)
treebb2646443349c8ff0787337f2be18cd0a4944ef3
parentdc7568986824c07cd841d002ef7f15f65a16846a (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;