# HG changeset patch # User Matti Hamalainen # Date 1403677985 -10800 # Node ID bda973fa2b3b59c15162c3b9e2d52037b4675226 # Parent 8c6b8cd42f620158bca047055fe814800360c6df Add proxy disable/enable setting. diff -r 8c6b8cd42f62 -r bda973fa2b3b main.c --- a/main.c Sun Jun 22 06:25:32 2014 +0300 +++ b/main.c Wed Jun 25 09:33:05 2014 +0300 @@ -78,6 +78,7 @@ *optNickSepStr = NULL; char optNickSep; BOOL optDaemon = FALSE, + optProxyEnable = FALSE, setIgnoreMode = FALSE, optDebug = FALSE, optLogEnable = FALSE, @@ -142,6 +143,7 @@ "(Only user/pass auth and no auth supported, no GSSAPI!)\n" "These can be set with the -P option as follows:\n" "\n" + " -P disable (to disable proxy use)\n" " -P ://[[:passwd]@][:]\n" " -P socks4://localhost:9000\n" " -P socks5://foobar:pass@localhost\n" @@ -193,6 +195,13 @@ *auth = NULL, *port = NULL; size_t len; + optProxyEnable = FALSE; + + // Handle disable case + if (strncasecmp(uri, "disab", 5) == 0) + return TRUE; + + // Split the URI if (!argSplitStr(uri, "://", &proto, &rest)) { THERR("Malformed proxy URI, should be ://[[:passwd]@][:]\n"); @@ -255,6 +264,7 @@ else optProxyAuthType = TH_PROXY_AUTH_NONE; + optProxyEnable = TRUE; ret = TRUE; out: @@ -2035,6 +2045,8 @@ th_cfg_add_section(&cfg, "server", tmpcfg); tmpcfg = NULL; + th_cfg_add_comment(&tmpcfg, "Enable proxy"); + th_cfg_add_bool(&tmpcfg, "enable", &optProxyEnable, optProxyEnable); th_cfg_add_comment(&tmpcfg, "Proxy URI (see comandline help for more information)"); th_cfg_add_string(&tmpcfg, "uri", &setProxyURI, NULL); th_cfg_add_section(&cfg, "proxy", tmpcfg); @@ -2227,7 +2239,7 @@ editState.conn = conn; // Are we using a proxy? - if (optProxyType != TH_PROXY_NONE && optProxyServer != NULL) + if (optProxyEnable && optProxyType != TH_PROXY_NONE && optProxyServer != NULL) { if (optProxyUserID == NULL) optProxyUserID = "James Bond";