]> git.mxchange.org Git - flightgear.git/commitdiff
Add an option to define the proxy settings (used by metar data fetching only at this...
authorehofman <ehofman>
Thu, 26 Feb 2004 12:57:38 +0000 (12:57 +0000)
committerehofman <ehofman>
Thu, 26 Feb 2004 12:57:38 +0000 (12:57 +0000)
src/Main/options.cxx

index dfd6abea64541f492ed7e77ec2fa29568cd402ee..df0513a4916f52f763ba76d4e8183956369e4cf0 100644 (file)
@@ -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 },