pidgin: 58cbac29: pidgin: Fix so that logging works again

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jan 15 00:55:41 EST 2012


----------------------------------------------------------------------
Revision: 58cbac2974d02267715f73cafaad11f0971a497f
Parent:   9bc480e430c705484b95bc77407b0956800cdab4
Author:   darkrain42 at pidgin.im
Date:     01/15/12 00:50:58
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/58cbac2974d02267715f73cafaad11f0971a497f

Changelog: 

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.

Changes against parent 9bc480e430c705484b95bc77407b0956800cdab4

  patched  libpurple/blist.c
  patched  libpurple/blist.h
  patched  pidgin/gtkconv.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	c821dfe91ddbd6930b60fcdf6f96908fb9078972
+++ pidgin/gtkconv.c	8de2d253c77dcc9b205d4c0ed3a464ebeb9f4442
@@ -5759,7 +5759,7 @@ private_gtkconv_new(PurpleConversation *
 	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);
 	}
============================================================
--- libpurple/blist.c	378a9f59fb3533ce6bf64daebc62f78fbaa1a59e
+++ libpurple/blist.c	62d794c97354ff531bbdd5c8e7452d0eebd0c307
@@ -2908,6 +2908,17 @@ purple_blist_node_get_type(PurpleBlistNo
 	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)
 {
============================================================
--- libpurple/blist.h	40d9ff9d90555932795e182096d851e6a580f6c9
+++ libpurple/blist.h	0eab7a006e97a74fea73f1e970ee2b3affb4853f
@@ -1052,6 +1052,16 @@ void purple_blist_request_add_group(void
 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


More information about the Commits mailing list