changeset 1440:6330d0bb309f

[gaim-migrate @ 1450] there's a reason why this was here committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 29 Jan 2001 01:13:31 +0000
parents 06a21ec0e269
children 5c67b8794991
files src/conversation.c
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Mon Jan 29 01:07:55 2001 +0000
+++ b/src/conversation.c	Mon Jan 29 01:13:31 2001 +0000
@@ -816,7 +816,7 @@
 	g_free(s);
 }
 
-static char *add_br(char *p)
+static char *html_logize(char *p)
 {
 
 	char *temp_p = p;
@@ -827,7 +827,7 @@
 
 	while (*temp_p != '\0') {
 		char_len++;
-		if (*temp_p == '\n')
+		if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!')))
 			num_cr++;
 		++temp_p;
 	}
@@ -837,15 +837,19 @@
 	buffer_start = buffer_p;
 
 	while (*temp_p != '\0') {
-		*buffer_p = *temp_p;
 		if (*temp_p == '\n') {
 			*buffer_p++ = '<';
 			*buffer_p++ = 'B';
 			*buffer_p++ = 'R';
 			*buffer_p++ = '>';
-			*buffer_p = '\n';
-		}
-		++buffer_p;
+			*buffer_p++ = '\n';
+		} else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) {
+			*buffer_p++ = '&';
+			*buffer_p++ = 'g';
+			*buffer_p++ = 't';
+			*buffer_p++ = ';';
+		} else
+			*buffer_p++ = *temp_p;
 		++temp_p;
 	}
 	*buffer_p = '\0';
@@ -1118,6 +1122,7 @@
 	char *smiley = g_malloc(7);
 	struct buddy *b;
 	int gtk_font_options = 0;
+	GString *logstr;
 
 	if (display_options & OPT_DISP_IGNORE_COLOUR)
 		gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COLOURS;
@@ -1131,6 +1136,8 @@
 	if (display_options & OPT_DISP_IGNORE_SIZES)
 		gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES;
 
+	if (!(general_options & OPT_GEN_STRIP_HTML))
+		gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG;
 
 	if (!who) {
 		if (flags & WFLAG_SEND) {
@@ -1235,7 +1242,7 @@
 
 		gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, 0);
 
-		gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options);
+		logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options);
 
 		gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
 
@@ -1251,15 +1258,16 @@
 				t1 = strip_html(buf);
 				t2 = strip_html(what);
 			} else {
-				t1 = add_br(buf);
-				t2 = add_br(what);
+				t1 = html_logize(buf);
+				t2 = html_logize(what);
 			}
 			fd = open_log_file(nm);
 			if (fd > 0) {
 				if (general_options & OPT_GEN_STRIP_HTML) {
 					fprintf(fd, "%s%s\n", t1, t2);
 				} else {
-					fprintf(fd, "%s%s<BR>\n", t1, t2);
+					fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str);
+					g_string_free(logstr, TRUE);
 				}
 				fclose(fd);
 			}