changeset 3457:222e23f91092

[gaim-migrate @ 3505] Deryni made it so we can all log chats and IMs seperately. He had it retain your old option--it would log both if you had it configured that way. I made it so that if you had logging on it will log IMs--but you'll have to turn on logging chats manually. So if you want to log chats, turn that on. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 28 Aug 2002 05:55:48 +0000
parents b48065e52337
children 66b1ad9782a9
files ChangeLog src/conversation.c src/gaim.h src/gaimrc.c src/prefs.c src/server.c src/util.c
diffstat 7 files changed, 49 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Aug 28 02:38:19 2002 +0000
+++ b/ChangeLog	Wed Aug 28 05:55:48 2002 +0000
@@ -50,6 +50,8 @@
 	* Improved MSN internationalization (Thanks A Lee)
 	* Can get info for ICQ and Jabber users from the "Edit
 	  Buddies" tab (Thanks click81)
+	* Option to log IMs and Chats seperately.  (Thanks Etan
+	  Reisner)
 
 version 0.59 (06/24/2002):
 	* Hungarian translation added (Thanks, Sutto Zoltan)
--- a/src/conversation.c	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/conversation.c	Wed Aug 28 05:55:48 2002 +0000
@@ -168,10 +168,10 @@
 	c = (struct conversation *)g_new0(struct conversation, 1);
 	g_snprintf(c->name, sizeof(c->name), "%s", name);
 
-	if ((logging_options & OPT_LOG_ALL) || find_log_info(c->name)) {
+	if ((logging_options & OPT_LOG_CONVOS) || find_log_info(c->name)) {
 		FILE *fd;
 
-		fd = open_log_file(c->name);
+		fd = open_log_file(c->name, c->is_chat);
 		if (fd) {
 			if (!(logging_options & OPT_LOG_STRIP_HTML))
 				fprintf(fd,
@@ -299,9 +299,14 @@
 	while (cnv) {
 		c = (struct conversation *)cnv->data;
 
-		if (c->log_button)
-			gtk_widget_set_sensitive(c->log_button,
-						 ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE);
+		if (c->log_button) {
+			if (c->is_chat)
+				gtk_widget_set_sensitive(c->log_button,
+						   ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE);
+			else
+				gtk_widget_set_sensitive(c->log_button,
+							 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE);
+		}
 
 		cnv = cnv->next;
 	}
@@ -312,10 +317,16 @@
 		while (bcs) {
 			c = (struct conversation *)bcs->data;
 
-			if (c->log_button)
-				gtk_widget_set_sensitive(c->log_button,
-							 ((logging_options & OPT_LOG_ALL)) ? FALSE :
-							 TRUE);
+			if (c->log_button) {
+				if (c->is_chat)
+					gtk_widget_set_sensitive(c->log_button,
+					 		   ((logging_options & OPT_LOG_CHATS)) ? FALSE :
+							   TRUE);
+				else
+					gtk_widget_set_sensitive(c->log_button,
+								 ((logging_options & OPT_LOG_CONVOS)) ? FALSE :
+								 TRUE);
+			}
 
 			bcs = bcs->next;
 		}
@@ -1871,7 +1882,9 @@
 			c->history = g_string_append(c->history, "<BR>\n");
 		}
 
-		if (!(flags & WFLAG_NOLOG) && ((logging_options & OPT_LOG_ALL) || find_log_info(c->name))) {
+		if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (logging_options & OPT_LOG_CHATS))
+								               || (!c->is_chat && (logging_options & OPT_LOG_CONVOS))
+															 || find_log_info(c->name))) {
 			char *t1;
 			char nm[256];
 
@@ -1884,7 +1897,7 @@
 				g_snprintf(nm, 256, "%s.chat", c->name);
 			else
 				g_snprintf(nm, 256, "%s", c->name);
-			fd = open_log_file(nm);
+			fd = open_log_file(nm, c->is_chat);
 			if (fd) {
 				if (logging_options & OPT_LOG_STRIP_HTML) {
 					fprintf(fd, "%s\n", t1);
@@ -1991,7 +2004,8 @@
 		}
 
 		/* XXX this needs to be updated for the new length argument */
-		if ((logging_options & OPT_LOG_ALL) || find_log_info(c->name)) {
+		if ((c->is_chat && (logging_options & OPT_LOG_CHATS))
+				|| (!c->is_chat && (logging_options & OPT_LOG_CONVOS)) || find_log_info(c->name)) {
 			char *t1, *t2;
 			char *nm = g_malloc(256);
 			if (c->is_chat)
@@ -2006,7 +2020,7 @@
 				t1 = html_logize(buf);
 				t2 = html_logize(what);
 			}
-			fd = open_log_file(nm);
+			fd = open_log_file(nm, c->is_chat);
 			if (fd) {
 				if (logging_options & OPT_LOG_STRIP_HTML) {
 					fprintf(fd, "%s%s\n", t1, t2);
@@ -2350,7 +2364,10 @@
 	c->speaker = speaker;
 	c->speaker_p = speaker_p;
 
-	gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE);
+	if (c->is_chat)
+		gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE);
+	else
+		gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE);		
 	gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
 	gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
 	gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
@@ -3248,7 +3265,8 @@
 		gtk_notebook_set_tab_label_text(nb, gtk_notebook_get_nth_page(nb, index), text);
 	} else {
 		char buf[256];
-		if ((find_log_info(c->name)) || (logging_options & OPT_LOG_ALL))
+		if ((find_log_info(c->name)) || (c->is_chat && (logging_options & OPT_LOG_CHATS))
+				|| (!c->is_chat && (logging_options & OPT_LOG_CONVOS)))
 			g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, text);
 		else
 			g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, text);
--- a/src/gaim.h	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/gaim.h	Wed Aug 28 05:55:48 2002 +0000
@@ -184,13 +184,14 @@
 #define OPT_MISC_STEALTH_TYPING         0x00000010
 
 extern guint logging_options;
-#define OPT_LOG_ALL			0x00000001
+#define OPT_LOG_CONVOS			0x00000001
 #define OPT_LOG_STRIP_HTML		0x00000002
 #define OPT_LOG_BUDDY_SIGNON		0x00000004
 #define OPT_LOG_BUDDY_IDLE		0x00000008
 #define OPT_LOG_BUDDY_AWAY		0x00000010
 #define OPT_LOG_MY_SIGNON		0x00000020
 #define OPT_LOG_INDIVIDUAL		0x00000040
+#define OPT_LOG_CHATS			0x00000100
 
 extern guint blist_options;
 #define OPT_BLIST_APP_BUDDY_SHOW	0x00000001
@@ -413,7 +414,7 @@
 extern void clean_pid();
 extern char *date();
 extern gint linkify_text(char *);
-extern FILE *open_log_file (char *);
+extern FILE *open_log_file (char *, int);
 extern char *sec_to_text(guint);
 extern struct aim_user *find_user(const char *, int);
 extern char *full_date();
--- a/src/gaimrc.c	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/gaimrc.c	Wed Aug 28 05:55:48 2002 +0000
@@ -811,7 +811,7 @@
 		if (!read_logging) {
 			logging_options = 0;
 			if (general_options & OPT_GEN_LOG_ALL)
-				logging_options |= OPT_LOG_ALL;
+  				logging_options |= OPT_LOG_CONVOS | OPT_LOG_CHATS; 
 			if (general_options & OPT_GEN_STRIP_HTML)
 				logging_options |= OPT_LOG_STRIP_HTML;
 		}
--- a/src/prefs.c	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/prefs.c	Wed Aug 28 05:55:48 2002 +0000
@@ -708,7 +708,8 @@
 	gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
 
 	vbox = make_frame (ret, _("Message Logs"));
-	gaim_button(_("_Log all conversations"), &logging_options_new, OPT_LOG_ALL, vbox);
+	gaim_button(_("_Log all Instant Messages"), &logging_options_new, OPT_LOG_CONVOS, vbox);
+	gaim_button(_("Log all c_hats"), &logging_options_new, OPT_LOG_CHATS, vbox);
 	gaim_button(_("Strip _HTML from logs"), &logging_options_new, OPT_LOG_STRIP_HTML, vbox);
 
 	vbox = make_frame (ret, _("System Logs"));
@@ -1615,7 +1616,7 @@
 	int option = logging_options ^ logging_options_new;
 	logging_options = logging_options_new;
 	
-	if (option & OPT_LOG_ALL)
+	if (option & OPT_LOG_CONVOS || option & OPT_LOG_CHATS)
 		update_log_convs();
 
 }
--- a/src/server.c	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/server.c	Wed Aug 28 05:55:48 2002 +0000
@@ -937,14 +937,14 @@
 	b->history = g_string_new("");
 	g_snprintf(b->name, 80, "%s", name);
 	
-	if ((logging_options & OPT_LOG_ALL) || find_log_info(b->name)) {
+	if ((logging_options & OPT_LOG_CHATS) || find_log_info(b->name)) {
 		FILE *fd;
 		char *filename;
 
 		filename = (char *)malloc(100);
 		g_snprintf(filename, 100, "%s.chat", b->name);
 
-		fd = open_log_file(filename);
+		fd = open_log_file(filename, b->is_chat);
 		if (fd) {
 			if (!(logging_options & OPT_LOG_STRIP_HTML))
 				fprintf(fd,
--- a/src/util.c	Wed Aug 28 02:38:19 2002 +0000
+++ b/src/util.c	Wed Aug 28 05:55:48 2002 +0000
@@ -400,7 +400,7 @@
 	return fd;
 }
 
-FILE *open_log_file(char *name)
+FILE *open_log_file(char *name, int is_chat)
 {
 	struct stat st;
 	char realname[256];
@@ -408,7 +408,9 @@
 	FILE *fd;
 	int flag = 0;
 
-	if (!(logging_options & OPT_LOG_ALL)) {
+	if (((is_chat == 2) && !(logging_options & OPT_LOG_INDIVIDUAL))
+		|| ((is_chat == 1) && !(logging_options & OPT_LOG_CHATS))
+		|| ((is_chat == 0) && !(logging_options & OPT_LOG_CONVOS))) {
 
 		l = find_log_info(name);
 		if (!l)
@@ -453,7 +455,7 @@
 	int x;
 
 	if (name)
-		return open_log_file(name);
+		return open_log_file(name, 2);
 	else
 		return open_gaim_log_file("system", &x);
 }