diff src/buddy_chat.c @ 2856:b1e300a85678

[gaim-migrate @ 2869] rewrote the html parser in gtkimhtml. yes, that's really all i did. the reason for the massive change is because i added a length argument, which then needed to be propogated down to everything that would ever receive anything that would get drawn to the window. the new parser isn't any faster. that wasn't my goal. it's much more understandable now (hopefully, anyway). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 08 Dec 2001 09:48:52 +0000
parents 86e74a0c2f6e
children d842df0f5fe1
line wrap: on
line diff
--- a/src/buddy_chat.c	Sat Dec 08 08:46:00 2001 +0000
+++ b/src/buddy_chat.c	Sat Dec 08 09:48:52 2001 +0000
@@ -605,7 +605,7 @@
 			g_free(tmp);
 			matches = g_list_remove(matches, matches->data);
 		}
-		write_to_conv(c, addthis, WFLAG_NOLOG, NULL, time(NULL));
+		write_to_conv(c, addthis, WFLAG_NOLOG, NULL, time(NULL), -1);
 		gtk_editable_insert_text(GTK_EDITABLE(c->entry), partial, strlen(partial), &start);
 		if (t == start) {
 			t = start + strlen(partial);
@@ -618,7 +618,7 @@
 	g_free(partial);
 }
 
-gboolean meify(char *message)
+gboolean meify(char *message, int len)
 {
 	/* read /me-ify : if the message (post-HTML) starts with /me, remove
 	 * the "/me " part of it (including that space) and return TRUE */
@@ -626,6 +626,8 @@
 	int inside_HTML = 0;	/* i really don't like descriptive names */
 	if (!c)
 		return FALSE;	/* um... this would be very bad if this happens */
+	if (len == -1)
+		len = strlen(message);
 	while (*c) {
 		if (inside_HTML) {
 			if (*c == '>')
@@ -637,12 +639,13 @@
 				break;
 		}
 		c++;		/* i really don't like c++ either */
+		len--;
 	}
 	/* k, so now we've gotten past all the HTML crap. */
 	if (!*c)
 		return FALSE;
 	if (!g_strncasecmp(c, "/me ", 4)) {
-		sprintf(c, "%s", c + 4);
+		memmove(c, c + 4, len - 4);
 		return TRUE;
 	} else
 		return FALSE;
@@ -721,7 +724,7 @@
 	if ((flag & WFLAG_RECV) && find_nick(b->gc, message))
 		flag |= WFLAG_NICK;
 
-	write_to_conv(b, message, flag, who, mtime);
+	write_to_conv(b, message, flag, who, mtime, -1);
 }
 
 
@@ -884,7 +887,7 @@
 
 	if (chat_options & OPT_CHAT_LOGON) {
 		g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name);
-		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL));
+		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
 	}
 }
 
@@ -958,7 +961,7 @@
 
 	if (chat_options & OPT_CHAT_LOGON) {
 		g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new);
-		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL));
+		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
 	}
 }
 
@@ -1007,7 +1010,7 @@
 			g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), buddy, reason);
 		else
 			g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy);
-		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL));
+		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
 	}
 }