From: ehofman Date: Thu, 26 Feb 2004 12:57:38 +0000 (+0000) Subject: Add an option to define the proxy settings (used by metar data fetching only at this... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dad0c2de100ad2dccf96ec1c7ad18e0106cf38fa;p=flightgear.git Add an option to define the proxy settings (used by metar data fetching only at this time). Usage: --proxy=user:pwd@host:port --- diff --git a/src/Main/options.cxx b/src/Main/options.cxx index dfd6abea6..df0513a49 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -869,6 +869,32 @@ fgOptStartDateGmt( const char *arg ) return FG_OPTIONS_OK; } +static int +fgSetupProxy( const char *arg ) +{ + string options = arg; + string host, port, auth; + int pos; + + host = port = auth = ""; + if ((pos = options.find("@")) != string::npos) + auth = options.substr(0, pos++); + else + pos = 0; + + host = options.substr(pos, options.size()); + if ((pos = host.find(":")) != string::npos) { + port = host.substr(++pos, host.size()); + host.erase(--pos, host.size()); + } + + fgSetString("/sim/presets/proxy/host", host.c_str()); + fgSetString("/sim/presets/proxy/port", port.c_str()); + fgSetString("/sim/presets/proxy/authentication", auth.c_str()); + + return FG_OPTIONS_OK; +} + static int fgOptTraceRead( const char *arg ) { @@ -1291,6 +1317,7 @@ struct OptionDesc { {"rul", true, OPTION_CHANNEL, "", false, "", 0 }, {"joyclient", true, OPTION_CHANNEL, "", false, "", 0 }, {"jsclient", true, OPTION_CHANNEL, "", false, "", 0 }, + {"proxy", true, OPTION_FUNC, "", false, "", fgSetupProxy }, #ifdef FG_MPLAYER_AS {"callsign", true, OPTION_STRING, "sim/multiplay/callsign", false, "", 0 }, {"multiplay", true, OPTION_CHANNEL, "", false, "", 0 },