diff libpurple/protocols/bonjour/bonjour.c @ 20761:fb70e89180a9

Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 03 Oct 2007 00:47:25 +0000
parents 44b4e8bd759b
children 24ce4fcce5b0 f3cfcbbac3d8
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c	Wed Oct 03 00:45:12 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Wed Oct 03 00:47:25 2007 +0000
@@ -26,6 +26,7 @@
 #define UNICODE
 #include <windows.h>
 #include <lm.h>
+#include "dns_sd_proxy.h"
 #endif
 
 #include "internal.h"
@@ -99,6 +100,17 @@
 	PurpleStatus *status;
 	PurplePresence *presence;
 
+#ifdef _WIN32
+	if (!dns_sd_available()) {
+		gc->wants_to_die = TRUE;
+		purple_connection_error(gc,
+			_("The Apple Bonjour For Windows toolkit wasn't found, see the FAQ at: "
+			  "http://developer.pidgin.im/wiki/Using%20Pidgin#CanIusePidginforBonjourLink-LocalMessaging"
+			  " for more information."));
+		return;
+	}
+#endif
+
 	gc->flags |= PURPLE_CONNECTION_HTML;
 	gc->proto_data = bd = g_new0(BonjourData, 1);
 
@@ -155,13 +167,13 @@
 	BonjourData *bd = connection->proto_data;
 
 	/* Stop looking for buddies in the LAN */
-	if (bd->dns_sd_data != NULL)
+	if (bd != NULL && bd->dns_sd_data != NULL)
 	{
 		bonjour_dns_sd_stop(bd->dns_sd_data);
 		bonjour_dns_sd_free(bd->dns_sd_data);
 	}
 
-	if (bd->jabber_data != NULL)
+	if (bd != NULL && bd->jabber_data != NULL)
 	{
 		/* Stop waiting for conversations */
 		bonjour_jabber_stop(bd->jabber_data);