changeset 22849:e6674df4cbf1

Changes suggested by QuLogic to fix my broken changes to the NetworkManager support. We should now properly honor NetworkManager.
author Richard Laager <rlaager@wiktel.com>
date Sat, 10 May 2008 05:15:58 +0000
parents 4f6040bb6f7a
children 780972e37f0c
files libpurple/network.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/network.c	Sat May 10 03:32:58 2008 +0000
+++ b/libpurple/network.c	Sat May 10 05:15:58 2008 +0000
@@ -594,17 +594,22 @@
 purple_network_is_available(void)
 {
 #ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H
-	/* Try NetworkManager first, maybe we'll get lucky */
-	if (nm_get_network_state() != NM_STATE_CONNECTED)
-	{
-		purple_debug_warning("network", "NetworkManager not active or reports no connection\n");
+	NMState state = nm_get_network_state();
+	if (state == NM_STATE_UNKNOWN)
+ 	{
+		purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n");
+ 		return TRUE;
+	}
+	else if (state == NM_STATE_CONNECTED)
 		return TRUE;
-	} else
-		return TRUE;
+
+	return FALSE;
+
 #elif defined _WIN32
 	return (current_network_count > 0);
+#else
+	return TRUE;
 #endif
-	return TRUE;
 }
 
 #ifdef HAVE_NETWORKMANAGER_NETWORKMANAGER_H