[next] telepathy-idle: ctcp: Don't bling the non-bling

George Kiagiadakis gkiagia at kemper.freedesktop.org
Sat Dec 3 12:51:01 UTC 2016


Module: telepathy-idle
Branch: next
Commit: cf646c5c0d8a47ae15e4ecbea015b75c56eea4a0
URL:    http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=cf646c5c0d8a47ae15e4ecbea015b75c56eea4a0

Author: Florian Müllner <fmuellner at gnome.org>
Date:   Sat Feb 13 10:08:42 2016 +0100

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;



More information about the telepathy-commits mailing list