changeset 7553:7d95978b07d9

[gaim-migrate @ 8167] Logginations committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 18 Nov 2003 04:39:50 +0000
parents 83453431d722
children 4267ac18fd07
files src/conversation.c src/gtkprefs.c src/log.c
diffstat 3 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Nov 18 04:01:23 2003 +0000
+++ b/src/conversation.c	Tue Nov 18 04:39:50 2003 +0000
@@ -807,7 +807,8 @@
 	conv->history      = g_string_new("");
 	conv->data         = g_hash_table_new_full(g_str_hash, g_str_equal,
 											   g_free, NULL);
-	conv->log          = gaim_log_new(GAIM_LOG_IM, name, account, time(NULL));
+	conv->log          = gaim_log_new(type == GAIM_CONV_IM ? GAIM_LOG_IM :
+					  type == GAIM_CONV_CHAT ? GAIM_LOG_CHAT : GAIM_LOG_IM, name, account, time(NULL));
 
 
 	if (type == GAIM_CONV_IM)
--- a/src/gtkprefs.c	Tue Nov 18 04:01:23 2003 +0000
+++ b/src/gtkprefs.c	Tue Nov 18 04:39:50 2003 +0000
@@ -1328,7 +1328,7 @@
 				  "/gaim/gtk/logging/log_ims", vbox);
 	prefs_checkbox(_("Log all c_hats"),
 				  "/gaim/gtk/logging/log_chats", vbox);
-
+/*
 	vbox = gaim_gtk_make_frame (ret, _("System Logs"));
 	prefs_checkbox(_("Log when buddies _sign on/sign off"),
 				   "/gaim/gtk/logging/log_signon_signoff", vbox);
@@ -1340,7 +1340,7 @@
 				   "/gaim/gtk/logging/log_own_states", vbox);
 	prefs_checkbox(_("I_ndividual log file for each buddy's signons"),
 				   "/gaim/gtk/logging/individual_logs", vbox);
-
+*/
 	gtk_widget_show_all(ret);
 	return ret;
 }
--- a/src/log.c	Tue Nov 18 04:01:23 2003 +0000
+++ b/src/log.c	Tue Nov 18 04:39:50 2003 +0000
@@ -65,7 +65,9 @@
 	g_return_if_fail(log->logger);
 	g_return_if_fail(log->logger->write);
 
-	(log->logger->write)(log, type, from, time, message);
+	if ( (gaim_prefs_get_bool("/gaim/gtk/logging/log_chats") && log->type == GAIM_LOG_CHAT) || 
+	     (gaim_prefs_get_bool("/gaim/gtk/logging/log_ims") && log->type == GAIM_LOG_IM))
+		(log->logger->write)(log, type, from, time, message);
 }
 
 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags)
@@ -191,6 +193,8 @@
 void gaim_log_init(void)
 {
 	gaim_prefs_add_none("/core/logging");
+	gaim_prefs_add_bool("/gaim/gtk/logging/log_ims", FALSE);
+	gaim_prefs_add_bool("/gaim/gtk/logging/log_chats", FALSE);
 	gaim_prefs_add_string("/core/logging/format", "txt");
 	gaim_log_logger_add(&html_logger);
 	gaim_log_logger_add(&txt_logger);
@@ -390,12 +394,19 @@
 		/* This log is new */
 		char *ud = gaim_user_dir();
 		char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
+		char *chat;
 		const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
 			(gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL);
 		char *dir;
 		char *filename;
 		FILE *file;
 
+		if (log->type == GAIM_LOG_CHAT) {
+			chat = g_strdup_printf("%s.chat", guy);
+			g_free(guy);
+			guy = chat;
+		}
+
 		strftime(date, sizeof(date), "%Y-%m-%d.%H%M%S.html", localtime(&log->time));
 
 		dir = g_build_filename(ud, "logs", NULL);
@@ -519,11 +530,17 @@
 		char *ud = gaim_user_dir();
 		char *filename;
 		char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
+		char *chat;
 		const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
 			(gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL);
 		char *dir;
 		FILE *file;
 
+		if (log->type == GAIM_LOG_CHAT) {
+			chat = g_strdup_printf("%s.chat", guy);
+			g_free(guy);
+			guy = chat;
+		}
 		strftime(date, sizeof(date), "%Y-%m-%d.%H%M%S.txt", localtime(&log->time));
 
 		dir = g_build_filename(ud, "logs", NULL);