plugins/yay/yay.c

changeset 1571
3271e3df69e6
parent 1565
95f2c94c708d
child 1657
776824df9fbd
--- 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;

mercurial