changeset 30917:e17ac5b9621f

g_hash_table_get_keys is GLIB>2.14.0 but we maintain compatibility with 2.12.0. So implement a workaround. media.c also uses g_hash_table_get_keys, but I didn't change that one.
author Mark Doliner <mark@kingant.net>
date Wed, 10 Nov 2010 01:17:22 +0000
parents 4ba00731d066
children 198375f06059
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Wed Nov 10 01:00:42 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Wed Nov 10 01:17:22 2010 +0000
@@ -637,6 +637,15 @@
 	return subtype1 - subtype2;
 }
 
+#if !GLIB_CHECK_VERSION(2,14,0)
+static void hash_table_get_list_of_keys(gpointer key, gpointer value, gpointer user_data)
+{
+	GList **handlers = (GList **)user_data;
+
+	*handlers = g_list_prepend(*handlers, key);
+}
+#endif /* GLIB < 2.12.0 */
+
 void
 oscar_login(PurpleAccount *account)
 {
@@ -706,7 +715,12 @@
 	oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0);
 
 	g_string_append(msg, "Registered handlers: ");
+#if GLIB_CHECK_VERSION(2,14,0)
 	handlers = g_hash_table_get_keys(od->handlerlist);
+#else
+	handlers = NULL;
+	g_hash_table_foreach(od->handlerlist, hash_table_get_list_of_keys, &handlers);
+#endif /* GLIB < 2.12.0 */
 	sorted_handlers = g_list_sort(g_list_copy(handlers), compare_handlers);
 	for (cur = sorted_handlers; cur; cur = cur->next) {
 		guint x = GPOINTER_TO_UINT(cur->data);