Mercurial > pidgin.yaz
diff libpurple/network.c @ 25343:b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
network is available, even if NetworkManager (or Windows) says it isn't.
This is useful for offline development with nullprpl. If you don't like
-f for this and would just like to keep the long option, I'm fine with that.
Also, remove a -x/--nocrash option in Pidgin that doesn't seem to do anything.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 28 Nov 2008 06:06:35 +0000 |
parents | 785db7300ef2 |
children | c0b42d6c2785 |
line wrap: on
line diff
--- a/libpurple/network.c Fri Nov 28 00:42:22 2008 +0000 +++ b/libpurple/network.c Fri Nov 28 06:06:35 2008 +0000 @@ -87,6 +87,10 @@ static NMState nm_get_network_state(void); #endif +#if defined(HAVE_NETWORKMANAGER) || defined(_WIN32) +static gboolean force_online; +#endif + const unsigned char * purple_network_ip_atoi(const char *ip) { @@ -598,6 +602,9 @@ purple_network_is_available(void) { #ifdef HAVE_NETWORKMANAGER + if (force_online) + return TRUE; + if (!have_nm_state) { have_nm_state = TRUE; @@ -612,12 +619,20 @@ return FALSE; #elif defined _WIN32 - return (current_network_count > 0); + return (current_network_count > 0 || force_online); #else return TRUE; #endif } +void +purple_network_force_online() +{ +#if defined(HAVE_NETWORKMANAGER) || defined(_WIN32) + force_online = TRUE; +#endif +} + #ifdef HAVE_NETWORKMANAGER static void nm_update_state(NMState state)