changeset 32474:53ae12ee0b68

pidgin: Fix so that logging works again This was broken in 941f205e71bee6f0fe79442af21238c088eecbac. The semantics are that the global setting is used if a per-blist-node doesn't exist. This requires we know whether one exists or not (value being non-NULL previously), hence the new API. I was going to add this as _get_type(), but I thought I remembered we were trying to move away from PurpleValue. Anyway, feel free to fix this another way before 3.0.0. Thanks to dvpdiner2 for narrowing down the offending commit.
author Paul Aurich <paul@darkrain42.org>
date Sun, 15 Jan 2012 05:50:58 +0000
parents 6ffb26b8a8ce
children ec30049bdf5b
files libpurple/blist.c libpurple/blist.h pidgin/gtkconv.c
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Wed Jan 11 01:03:31 2012 +0000
+++ b/libpurple/blist.c	Sun Jan 15 05:50:58 2012 +0000
@@ -2908,6 +2908,17 @@
 	return node->type;
 }
 
+gboolean
+purple_blist_node_has_setting(PurpleBlistNode* node, const char *key)
+{
+	g_return_val_if_fail(node != NULL, FALSE);
+	g_return_val_if_fail(node->settings != NULL, FALSE);
+	g_return_val_if_fail(key != NULL, FALSE);
+
+	/* Boxed type, so it won't ever be NULL, so no need for _extended */
+	return (g_hash_table_lookup(node->settings, key) != NULL);
+}
+
 void
 purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data)
 {
--- a/libpurple/blist.h	Wed Jan 11 01:03:31 2012 +0000
+++ b/libpurple/blist.h	Sun Jan 15 05:50:58 2012 +0000
@@ -1052,6 +1052,16 @@
 void purple_blist_request_add_group(void);
 
 /**
+ * Checks whether a named setting exists for a node in the buddy list
+ *
+ * @param node  The node to check from which to check settings
+ * @param key   The identifier of the data
+ *
+ * @return TRUE if a value exists, or FALSE if there is no setting
+ */
+gboolean purple_blist_node_has_setting(PurpleBlistNode *node, const char *key);
+
+/**
  * Associates a boolean with a node in the buddy list
  *
  * @param node  The node to associate the data with
--- a/pidgin/gtkconv.c	Wed Jan 11 01:03:31 2012 +0000
+++ b/pidgin/gtkconv.c	Sun Jan 15 05:50:58 2012 +0000
@@ -5759,7 +5759,7 @@
 	if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
 		gtkconv->make_sound = TRUE;
 
-	if (convnode != NULL) {
+	if (convnode != NULL && purple_blist_node_has_setting(convnode, "enable-logging")) {
 		gboolean logging = purple_blist_node_get_bool(convnode, "enable-logging");
 		purple_conversation_set_logging(conv, logging);
 	}