changeset 22009:1494e0a0f2b9

Save the conversation "Enable Logging" option per-contact. committer: Richard Laager <rlaager@wiktel.com>
author Moos Heintzen <iwasroot@gmail.com>
date Sat, 05 Jan 2008 16:32:40 +0000
parents 5c472f6aa039
children 7e5ecf03b69d
files COPYRIGHT ChangeLog pidgin/gtkconv.c
diffstat 3 files changed, 37 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Thu Jan 03 20:28:16 2008 +0000
+++ b/COPYRIGHT	Sat Jan 05 16:32:40 2008 +0000
@@ -167,6 +167,7 @@
 Nick Hebner
 Mike Heffner
 Justin Heiner
+Moos Heintzen
 Benjamin Herrenschmidt
 Fernando Herrera
 hjheins
--- a/ChangeLog	Thu Jan 03 20:28:16 2008 +0000
+++ b/ChangeLog	Sat Jan 05 16:32:40 2008 +0000
@@ -12,8 +12,10 @@
 	* Added the ability to theme conversation name colors (red and blue)
 	  through your GTK+ theme, and exposed those theme settings to the 
 	  Pidgin GTK+ Theme Control plugin (Dustin Howett)
-	* Fixed having multiple alias edit areas in the infopane (Elliott Sales de
-	  Andrade)
+	* Fixed having multiple alias edit areas in the infopane (Elliott Sales
+	  de Andrade)
+	* Save the conversation "Enable Logging" option per-contact (Moos
+	  Heintzen)
 
 	Finch:
 	* Color is used in the buddylist to indicate status, and the conversation
--- a/pidgin/gtkconv.c	Thu Jan 03 20:28:16 2008 +0000
+++ b/pidgin/gtkconv.c	Sat Jan 05 16:32:40 2008 +0000
@@ -1350,6 +1350,7 @@
 	PidginWindow *win = data;
 	PurpleConversation *conv;
 	gboolean logging;
+	PurpleBlistNode *node;
 
 	conv = pidgin_conv_window_get_active_conversation(win);
 
@@ -1360,6 +1361,8 @@
 
 	if (logging == purple_conversation_is_logging(conv))
 		return;
+	
+	node = get_conversation_blist_node(conv);
 
 	if (logging)
 	{
@@ -1383,6 +1386,27 @@
 		/* Disable the logging second, so that the above message can be logged. */
 		purple_conversation_set_logging(conv, FALSE);
 	}
+
+	/* Save the setting IFF it's different than the pref. */
+	switch (conv->type)
+	{
+		case PURPLE_CONV_TYPE_IM:
+			if (logging == purple_prefs_get_bool("/purple/logging/log_ims"))
+				purple_blist_node_remove_setting(node, "enable-logging");
+			else
+				purple_blist_node_set_bool(node, "enable-logging", logging);
+			break;
+
+		case PURPLE_CONV_TYPE_CHAT:
+			if (logging == purple_prefs_get_bool("/purple/logging/log_chats"))
+				purple_blist_node_remove_setting(node, "enable-logging");
+			else
+				purple_blist_node_set_bool(node, "enable-logging", logging);
+			break;
+
+		default:
+			break;
+	}
 }
 
 static void
@@ -4907,6 +4931,7 @@
 	GtkWidget *pane = NULL;
 	GtkWidget *tab_cont;
 	PurpleBlistNode *convnode;
+	PurpleValue *value;
 
 	if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
 		conv->ui_data = gtkconv;
@@ -4994,6 +5019,13 @@
 	if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
 		gtkconv->make_sound = TRUE;
 
+	if (convnode != NULL &&
+	    (value = g_hash_table_lookup(convnode->settings, "enable-logging")) &&
+	    purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN)
+	{
+		purple_conversation_set_logging(conv, purple_value_get_boolean(value));
+	}
+
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
 		gtk_widget_show(gtkconv->toolbar);
 	else