diff libpurple/protocols/bonjour/jabber.c @ 17495:d7b50cac1c7a

This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it. There are a few changes by me, mainly to fix the howl implementation. Fixes #1117 . There appear to be a few bugs, but I believe that they were also present previously. I'm hoping to do some more tweaking before the next release. The howl implementation will eventually be supersceded by a native avahi implementation, so I opted for a somewhat dirty hack to enable it instead of doing something with config.h.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 05 Jun 2007 03:38:22 +0000
parents 7ade887fd3f6
children bca2780f7669
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Tue Jun 05 03:13:02 2007 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Tue Jun 05 03:38:22 2007 +0000
@@ -51,18 +51,19 @@
 	gint socket_fd;
 	gint retorno = 0;
 	struct sockaddr_in buddy_address;
+	BonjourBuddy *bb = gb->proto_data;
 
 	/* Create a socket and make it non-blocking */
 	socket_fd = socket(PF_INET, SOCK_STREAM, 0);
 
 	buddy_address.sin_family = PF_INET;
-	buddy_address.sin_port = htons(((BonjourBuddy*)(gb->proto_data))->port_p2pj);
-	inet_aton(((BonjourBuddy*)(gb->proto_data))->ip, &(buddy_address.sin_addr));
+	buddy_address.sin_port = htons(bb->port_p2pj);
+	inet_aton(bb->ip, &(buddy_address.sin_addr));
 	memset(&(buddy_address.sin_zero), '\0', 8);
 
 	retorno = connect(socket_fd, (struct sockaddr*)&buddy_address, sizeof(struct sockaddr));
 	if (retorno == -1) {
-		purple_debug_warning("bonjour", "connect error: %s\n", strerror(errno));
+		purple_debug_warning("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", purple_buddy_get_name(gb), bb->ip ? bb->ip : "(null)", buddy_address.sin_port, strerror(errno));
 	}
 	fcntl(socket_fd, F_SETFL, O_NONBLOCK);