changeset 1434:348a70e15f07

[gaim-migrate @ 1444] no more option to strip html. it didn't work anyway. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 28 Jan 2001 09:09:18 +0000
parents f2f45486d656
children f16e17d42b43
files src/conversation.c src/gaim.h src/prefs.c src/server.c
diffstat 4 files changed, 22 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Sun Jan 28 02:46:07 2001 +0000
+++ b/src/conversation.c	Sun Jan 28 09:09:18 2001 +0000
@@ -114,12 +114,8 @@
 
 		fd = open_log_file(c->name);
 		if (fd > 0) {
-			if (!(general_options & OPT_GEN_STRIP_HTML))
-				fprintf(fd,
-					"<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
+			fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
 					full_date());
-			else
-				fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
 			fclose(fd);
 		} else
 			/* do we want to do something here? */ ;
@@ -818,7 +814,7 @@
 	g_free(s);
 }
 
-static char *add_br(char *p)
+static char *html_logize(char *p)
 {
 
 	char *temp_p = p;
@@ -829,7 +825,7 @@
 
 	while (*temp_p != '\0') {
 		char_len++;
-		if (*temp_p == '\n')
+		if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!')))
 			num_cr++;
 		++temp_p;
 	}
@@ -839,15 +835,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';
@@ -1161,30 +1161,17 @@
 		gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
 
 		if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
-			char *t1;
 			char nm[256];
 
-			if (general_options & OPT_GEN_STRIP_HTML) {
-				t1 = strip_html(what);
-			} else {
-				t1 = what;
-			}
 			if (c->is_chat)
 				g_snprintf(nm, 256, "%s.chat", c->name);
 			else
 				g_snprintf(nm, 256, "%s", c->name);
 			fd = open_log_file(nm);
 			if (fd > 0) {
-				if (general_options & OPT_GEN_STRIP_HTML) {
-					fprintf(fd, "%s\n", t1);
-				} else {
-					fprintf(fd, "%s<BR>\n", t1);
-				}
+				fprintf(fd, "%s<BR>\n", what);
 				fclose(fd);
 			}
-			if (general_options & OPT_GEN_STRIP_HTML) {
-				g_free(t1);
-			}
 		}
 
 	} else {
@@ -1236,32 +1223,20 @@
 		gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
 
 		if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
-			char *t1, *t2;
-			char *nm = g_malloc(256);
+			char *t1;
+			char nm[256];
 			if (c->is_chat)
 				g_snprintf(nm, 256, "%s.chat", c->name);
 			else
 				g_snprintf(nm, 256, "%s", c->name);
 
-			if (general_options & OPT_GEN_STRIP_HTML) {
-				t1 = strip_html(buf);
-				t2 = strip_html(what);
-			} else {
-				t1 = add_br(buf);
-				t2 = add_br(what);
-			}
+			t1 = 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<BR>\n", buf, t1);
 				fclose(fd);
 			}
 			g_free(t1);
-			g_free(t2);
-			g_free(nm);
 		}
 	}
 
--- a/src/gaim.h	Sun Jan 28 02:46:07 2001 +0000
+++ b/src/gaim.h	Sun Jan 28 09:09:18 2001 +0000
@@ -440,7 +440,7 @@
 #define OPT_GEN_ENTER_SENDS       0x00000001
 /* #define OPT_GEN_AUTO_LOGIN        0x00000002 now OPT_USR_AUTO */
 #define OPT_GEN_LOG_ALL           0x00000004
-#define OPT_GEN_STRIP_HTML        0x00000008
+/* #define OPT_GEN_STRIP_HTML        0x00000008 this didn't work anyway */
 #define OPT_GEN_APP_BUDDY_SHOW    0x00000010
 #define OPT_GEN_POPUP_WINDOWS     0x00000020
 #define OPT_GEN_SEND_LINKS        0x00000040
--- a/src/prefs.c	Sun Jan 28 02:46:07 2001 +0000
+++ b/src/prefs.c	Sun Jan 28 09:09:18 2001 +0000
@@ -260,7 +260,6 @@
 	gtk_widget_show(sep);
 
 	gaim_button(_("Log all conversations"), &general_options, OPT_GEN_LOG_ALL, box);
-	gaim_button(_("Strip HTML from logs"), &general_options, OPT_GEN_STRIP_HTML, box);
 
 	sep = gtk_hseparator_new();
 	gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5);
--- a/src/server.c	Sun Jan 28 02:46:07 2001 +0000
+++ b/src/server.c	Sun Jan 28 09:09:18 2001 +0000
@@ -639,14 +639,11 @@
 		g_snprintf(filename, 100, "%s.chat", b->name);
 
 		fd = open_log_file(filename);
-		if (!(general_options & OPT_GEN_STRIP_HTML))
-			fprintf(fd,
-				"<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
-				full_date());
-		else
-			fprintf(fd, "---- New Conversation @ %s ----\n", full_date());
-
-		fclose(fd);
+		if (fd > 0) {
+			fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
+					full_date());
+			fclose(fd);
+		}
 		free(filename);
 	}