Mercurial > pidgin.yaz
diff pidgin/gtkmain.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 | 38a2f78f80a7 |
children | 3687049b4faf |
line wrap: on
line diff
--- a/pidgin/gtkmain.c Fri Nov 28 00:42:22 2008 +0000 +++ b/pidgin/gtkmain.c Fri Nov 28 06:06:35 2008 +0000 @@ -390,6 +390,7 @@ "Usage: %s [OPTION]...\n\n" " -c, --config=DIR use DIR for config files\n" " -d, --debug print debugging messages to stdout\n" + " -f, --force-online force online, regardless of network status\n" " -h, --help display this help and exit\n" " -m, --multiple do not ensure single instance\n" " -n, --nologin don't automatically login\n" @@ -403,6 +404,7 @@ "Usage: %s [OPTION]...\n\n" " -c, --config=DIR use DIR for config files\n" " -d, --debug print debugging messages to stdout\n" + " -f, --force-online force online, regardless of network status\n" " -h, --help display this help and exit\n" " -m, --multiple do not ensure single instance\n" " -n, --nologin don't automatically login\n" @@ -462,10 +464,10 @@ int main(int argc, char *argv[]) #endif { + gboolean opt_force_online = FALSE; gboolean opt_help = FALSE; gboolean opt_login = FALSE; gboolean opt_nologin = FALSE; - gboolean opt_nocrash = FALSE; gboolean opt_version = FALSE; gboolean opt_si = TRUE; /* Check for single instance? */ char *opt_config_dir_arg = NULL; @@ -490,17 +492,17 @@ GList *active_accounts; struct option long_options[] = { - {"config", required_argument, NULL, 'c'}, - {"debug", no_argument, NULL, 'd'}, - {"help", no_argument, NULL, 'h'}, - {"login", optional_argument, NULL, 'l'}, - {"multiple", no_argument, NULL, 'm'}, - {"nologin", no_argument, NULL, 'n'}, - {"nocrash", no_argument, NULL, 'x'}, - {"session", required_argument, NULL, 's'}, - {"version", no_argument, NULL, 'v'}, - {"display", required_argument, NULL, 'D'}, - {"sync", no_argument, NULL, 'S'}, + {"config", required_argument, NULL, 'c'}, + {"debug", no_argument, NULL, 'd'}, + {"force-online", no_argument, NULL, 'd'}, + {"help", no_argument, NULL, 'h'}, + {"login", optional_argument, NULL, 'l'}, + {"multiple", no_argument, NULL, 'm'}, + {"nologin", no_argument, NULL, 'n'}, + {"session", required_argument, NULL, 's'}, + {"version", no_argument, NULL, 'v'}, + {"display", required_argument, NULL, 'D'}, + {"sync", no_argument, NULL, 'S'}, {0, 0, 0, 0} }; @@ -607,9 +609,9 @@ opterr = 1; while ((opt = getopt_long(argc, argv, #ifndef _WIN32 - "c:dhmnl::s:v", + "c:dfhmnl::s:v", #else - "c:dhmnl::v", + "c:dfhmnl::v", #endif long_options, NULL)) != -1) { switch (opt) { @@ -620,6 +622,9 @@ case 'd': /* debug */ debug_enabled = TRUE; break; + case 'f': /* force-online */ + opt_force_online = TRUE; + break; case 'h': /* help */ opt_help = TRUE; break; @@ -642,9 +647,6 @@ case 'm': /* do not ensure single instance. */ opt_si = FALSE; break; - case 'x': /* --nocrash */ - opt_nocrash = TRUE; - break; case 'D': /* --display */ case 'S': /* --sync */ /* handled by gtk_init_check below */ @@ -821,6 +823,11 @@ opt_config_dir_arg = NULL; } + /* This needs to be before purple_blist_show() so the + * statusbox gets the forced online status. */ + if (opt_force_online) + purple_network_force_online(); + /* * We want to show the blist early in the init process so the * user feels warm and fuzzy (not cold and prickley).