changeset 1571:bbdc5eefd243

[gaim-migrate @ 1581] ignore "\033[..?m" committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 15 Mar 2001 03:49:25 +0000
parents 4a47a459cc98
children d60672672a13
files plugins/yay/yay.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/yay/yay.c	Wed Mar 14 20:11:04 2001 +0000
+++ b/plugins/yay/yay.c	Thu Mar 15 03:49:25 2001 +0000
@@ -134,6 +134,8 @@
 	struct gaim_connection *gc = sess->user_data;
 	struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
 	char buf[BUF_LEN * 4];
+	char *tmp, *c, *e;
+	int at = 0;
 
 	va_list ap;
 	char *id, *nick, *msg;
@@ -144,7 +146,20 @@
 	msg = va_arg(ap, char *);
 	va_end(ap);
 
-	g_snprintf(buf, sizeof(buf), "%s", msg);
+	e = tmp = g_strdup(msg);
+
+	while ((c = strchr(e, '\033')) != NULL) {
+		*c++ = '\0';
+		at += g_snprintf(buf + at, sizeof(buf) - at, "%s", e);
+		e = ++c;
+		while (*e && (*e++ != 'm'));
+	}
+
+	if (*e)
+		g_snprintf(buf + at, sizeof(buf) - at, "%s", e);
+
+	g_free(tmp);
+
 	serv_got_im(gc, nick, buf, 0);
 
 	return 1;