comparison libpurple/network.c @ 25918:bc8d1607f9b8

propagate from branch 'im.pidgin.pidgin' (head 566d2e86bfd45c806aba1b32d6f85a9a409ff9ea) to branch 'im.pidgin.pidgin.next.minor' (head ffd76856f93610f7cd6178e943d0b61e4220b549)
author Richard Laager <rlaager@wiktel.com>
date Mon, 26 Jan 2009 02:39:55 +0000
parents c0b42d6c2785
children 4b8c4870b13a
comparison
equal deleted inserted replaced
25372:a8db457c421a 25918:bc8d1607f9b8
90 90
91 #ifdef HAVE_NETWORKMANAGER 91 #ifdef HAVE_NETWORKMANAGER
92 static NMState nm_get_network_state(void); 92 static NMState nm_get_network_state(void);
93 #endif 93 #endif
94 94
95 #if defined(HAVE_NETWORKMANAGER) || defined(_WIN32)
96 static gboolean force_online;
97 #endif
98
95 const unsigned char * 99 const unsigned char *
96 purple_network_ip_atoi(const char *ip) 100 purple_network_ip_atoi(const char *ip)
97 { 101 {
98 static unsigned char ret[4]; 102 static unsigned char ret[4];
99 gchar *delimiter = "."; 103 gchar *delimiter = ".";
646 650
647 gboolean 651 gboolean
648 purple_network_is_available(void) 652 purple_network_is_available(void)
649 { 653 {
650 #ifdef HAVE_NETWORKMANAGER 654 #ifdef HAVE_NETWORKMANAGER
655 if (force_online)
656 return TRUE;
657
651 if (!have_nm_state) 658 if (!have_nm_state)
652 { 659 {
653 have_nm_state = TRUE; 660 have_nm_state = TRUE;
654 nm_state = nm_get_network_state(); 661 nm_state = nm_get_network_state();
655 if (nm_state == NM_STATE_UNKNOWN) 662 if (nm_state == NM_STATE_UNKNOWN)
660 return TRUE; 667 return TRUE;
661 668
662 return FALSE; 669 return FALSE;
663 670
664 #elif defined _WIN32 671 #elif defined _WIN32
665 return (current_network_count > 0); 672 return (current_network_count > 0 || force_online);
666 #else 673 #else
667 return TRUE; 674 return TRUE;
675 #endif
676 }
677
678 void
679 purple_network_force_online()
680 {
681 #if defined(HAVE_NETWORKMANAGER) || defined(_WIN32)
682 force_online = TRUE;
668 #endif 683 #endif
669 } 684 }
670 685
671 #ifdef HAVE_NETWORKMANAGER 686 #ifdef HAVE_NETWORKMANAGER
672 static void 687 static void