comparison libpurple/protocols/oscar/oscar.c @ 31357: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 91d3b40a2f70
children 198375f06059
comparison
equal deleted inserted replaced
31356:4ba00731d066 31357:e17ac5b9621f
634 if (family1 != family2) { 634 if (family1 != family2) {
635 return family1 - family2; 635 return family1 - family2;
636 } 636 }
637 return subtype1 - subtype2; 637 return subtype1 - subtype2;
638 } 638 }
639
640 #if !GLIB_CHECK_VERSION(2,14,0)
641 static void hash_table_get_list_of_keys(gpointer key, gpointer value, gpointer user_data)
642 {
643 GList **handlers = (GList **)user_data;
644
645 *handlers = g_list_prepend(*handlers, key);
646 }
647 #endif /* GLIB < 2.12.0 */
639 648
640 void 649 void
641 oscar_login(PurpleAccount *account) 650 oscar_login(PurpleAccount *account)
642 { 651 {
643 PurpleConnection *gc; 652 PurpleConnection *gc;
704 oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0); 713 oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0);
705 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0); 714 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0);
706 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0); 715 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0);
707 716
708 g_string_append(msg, "Registered handlers: "); 717 g_string_append(msg, "Registered handlers: ");
718 #if GLIB_CHECK_VERSION(2,14,0)
709 handlers = g_hash_table_get_keys(od->handlerlist); 719 handlers = g_hash_table_get_keys(od->handlerlist);
720 #else
721 handlers = NULL;
722 g_hash_table_foreach(od->handlerlist, hash_table_get_list_of_keys, &handlers);
723 #endif /* GLIB < 2.12.0 */
710 sorted_handlers = g_list_sort(g_list_copy(handlers), compare_handlers); 724 sorted_handlers = g_list_sort(g_list_copy(handlers), compare_handlers);
711 for (cur = sorted_handlers; cur; cur = cur->next) { 725 for (cur = sorted_handlers; cur; cur = cur->next) {
712 guint x = GPOINTER_TO_UINT(cur->data); 726 guint x = GPOINTER_TO_UINT(cur->data);
713 g_string_append_printf(msg, "%04x/%04x, ", x >> 16, x & 0xFFFF); 727 g_string_append_printf(msg, "%04x/%04x, ", x >> 16, x & 0xFFFF);
714 } 728 }