changeset 12708:495856ce025b

[gaim-migrate @ 15052] g_hash_table_find is only in 2.4 or later. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 03 Jan 2006 23:31:29 +0000
parents 0438f853fc89
children b4bd3b41bf3b
files src/protocols/bonjour/jabber.c
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/bonjour/jabber.c	Tue Jan 03 22:44:41 2006 +0000
+++ b/src/protocols/bonjour/jabber.c	Tue Jan 03 23:31:29 2006 +0000
@@ -218,21 +218,21 @@
 	g_free(html_body);
 }
 
-static gboolean
-_check_buddy_by_address(gpointer key, gpointer value, gpointer address)
+struct _check_buddy_by_address_t {
+	char *address;
+	GaimBuddy **gb;
+};
+
+static void
+_check_buddy_by_address(gpointer key, gpointer value, gpointer data)
 {
 	GaimBuddy *gb = (GaimBuddy*)value;
 	BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
+	struct _check_buddy_by_address_t *d = (struct _check_buddy_by_address_t *)data; 
 
-	if (bb != NULL)
-	{
-		if (g_strcasecmp(bb->ip, (char*)address) == 0) {
-			return TRUE;
-		} else {
-			return FALSE;
-		}
-	} else {
-		return FALSE;
+	if (bb != NULL) {
+		if (g_strcasecmp(bb->ip, (char*)d->address) == 0) 
+			*(d->gb) = gb;      
 	}
 }
 
@@ -386,7 +386,11 @@
 
 	/* Look for the buddy that has open the conversation and fill information */
 	address_text = inet_ntoa(their_addr.sin_addr);
-	gb = (GaimBuddy*)g_hash_table_find(bl->buddies, _check_buddy_by_address, address_text);
+	struct _check_buddy_by_address_t *cbba = g_new0(struct _check_buddy_by_address_t, 1);
+	cbba->address = address_text;
+	cbba->gb = &gb;
+	g_hash_table_foreach(bl->buddies, _check_buddy_by_address, address_text);
+	g_free(cbba);
 	if (gb == NULL)
 	{
 		gaim_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n");