diff src/gtkconv.c @ 11672:04e0189bb519

[gaim-migrate @ 13958] (contact-aware conversation)-aware logging: When the active buddy changes, a new log is opened. This way, the logs (on-disk, assuming a file-based logger) always correspond to the buddy that send/received the messages. Given that we already have contactized logging, the logs will all be shown in the same log viewer. Also, if you use Options -> Enable Logging to change the default logging mode for a perticular conversation or part of a conversation, that setting will be preserved even if the active buddy changes. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 16 Oct 2005 18:15:47 +0000
parents 4ebd27e664c4
children c1906dc6257c
line wrap: on
line diff
--- a/src/gtkconv.c	Sat Oct 15 19:25:18 2005 +0000
+++ b/src/gtkconv.c	Sun Oct 16 18:15:47 2005 +0000
@@ -1891,6 +1891,26 @@
 }
 
 static void
+gaim_gtkconv_set_active_conversation(GaimConversation *conv)
+{
+	GaimGtkConversation *gtkconv;
+
+	g_return_if_fail(conv != NULL);
+
+	gtkconv = GAIM_GTK_CONVERSATION(conv);
+
+	if (gtkconv->active_conv == conv)
+		return;
+
+	gaim_conversation_close_logs(gtkconv->active_conv);
+
+	gtkconv->active_conv = conv;
+
+	gaim_conversation_set_logging(conv,
+		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
+}
+
+static void
 gaim_gtkconv_switch_active_conversation(GaimConversation *conv)
 {
 	GaimGtkConversation *gtkconv;
@@ -1899,14 +1919,11 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	gtkconv->active_conv = conv;
+	gaim_gtkconv_set_active_conversation(conv);
 
 	gray_stuff_out(gtkconv);
 	update_typing_icon(gtkconv);
 
-	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
-	                               gaim_conversation_is_logging(conv));
-
 	gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
 	                     gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
 
@@ -3899,7 +3916,7 @@
 	GaimGtkConversation *gtkconv;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
-	gtkconv->active_conv = conv;
+	gaim_gtkconv_set_active_conversation(conv);
 
 	gtkconv->u.im->a_virgin = FALSE;
 
@@ -3913,7 +3930,7 @@
 	GaimGtkConversation *gtkconv;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
-	gtkconv->active_conv = conv;
+	gaim_gtkconv_set_active_conversation(conv);
 
 	flags |= GAIM_MESSAGE_COLORIZE;
 
@@ -4025,7 +4042,7 @@
 
 	/* Set the active conversation to the one that just messaged us. */
 	/* TODO: consider not doing this if the account is offline or something */
-	gtkconv->active_conv = conv;
+	gaim_gtkconv_set_active_conversation(conv);
 
 	gc = gaim_conversation_get_gc(conv);
 	account = gaim_conversation_get_account(conv);
@@ -6095,6 +6112,9 @@
 
 	/* Update the menubar */
 
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
+	                               gaim_conversation_is_logging(conv));
+
 	generate_send_to_items(win);
 
 	gaim_gtkconv_switch_active_conversation(conv);