Mercurial > hg > nnchat
comparison main.c @ 609:b10d81ddfc55
Use URI form of proxy configuration in the config file as well.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 20 May 2014 04:44:45 +0300 |
parents | a8fa7803284a |
children | 59588bbf8d55 |
comparison
equal
deleted
inserted
replaced
608:a8fa7803284a | 609:b10d81ddfc55 |
---|---|
1926 BOOL argsOK, colorSet = FALSE; | 1926 BOOL argsOK, colorSet = FALSE; |
1927 nn_conn_t *conn = NULL; | 1927 nn_conn_t *conn = NULL; |
1928 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); | 1928 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); |
1929 nn_editstate_t editState; | 1929 nn_editstate_t editState; |
1930 th_cfgitem_t *tmpcfg; | 1930 th_cfgitem_t *tmpcfg; |
1931 char *setHomeDir = NULL; | 1931 char *setHomeDir = NULL, *setProxyURI = NULL; |
1932 | 1932 |
1933 memset(editHistBuf, 0, sizeof(editHistBuf)); | 1933 memset(editHistBuf, 0, sizeof(editHistBuf)); |
1934 clearEditState(&editState); | 1934 clearEditState(&editState); |
1935 | 1935 |
1936 // Initialize | 1936 // Initialize |
1974 th_cfg_add_comment(&tmpcfg, "Default port to connect"); | 1974 th_cfg_add_comment(&tmpcfg, "Default port to connect"); |
1975 th_cfg_add_int(&tmpcfg, "port", &optPort, optPort); | 1975 th_cfg_add_int(&tmpcfg, "port", &optPort, optPort); |
1976 th_cfg_add_section(&cfg, "server", tmpcfg); | 1976 th_cfg_add_section(&cfg, "server", tmpcfg); |
1977 | 1977 |
1978 tmpcfg = NULL; | 1978 tmpcfg = NULL; |
1979 th_cfg_add_comment(&tmpcfg, "Proxy server type (0 = none, 1 = SOCKS 4, 2 = SOCKS 4a)"); | 1979 th_cfg_add_comment(&tmpcfg, "Proxy URI (see comandline help for more information)"); |
1980 th_cfg_add_int(&tmpcfg, "type", &optProxyType, optProxyType); | 1980 th_cfg_add_string(&tmpcfg, "uri", &setProxyURI, NULL); |
1981 th_cfg_add_comment(&tmpcfg, "Proxy server host name"); | |
1982 th_cfg_add_string(&tmpcfg, "host", &optProxyServer, optProxyServer); | |
1983 th_cfg_add_comment(&tmpcfg, "Proxy port, 1080 is the standard SOCKS port"); | |
1984 th_cfg_add_int(&tmpcfg, "port", &optProxyPort, optProxyPort); | |
1985 th_cfg_add_comment(&tmpcfg, "Proxy user ID"); | |
1986 th_cfg_add_string(&tmpcfg, "userid", &optProxyUserID, optProxyUserID); | |
1987 // th_cfg_add_comment(&tmpcfg, "Proxy password (only available for SOCKS 5)"); | |
1988 // th_cfg_add_string(&tmpcfg, "password", &optProxyPassword, optProxyPassword); | |
1989 th_cfg_add_section(&cfg, "proxy", tmpcfg); | 1981 th_cfg_add_section(&cfg, "proxy", tmpcfg); |
1990 | 1982 |
1991 | 1983 |
1992 tmpcfg = NULL; | 1984 tmpcfg = NULL; |
1993 th_cfg_add_comment(&tmpcfg, "Enable logging"); | 1985 th_cfg_add_comment(&tmpcfg, "Enable logging"); |
2042 { | 2034 { |
2043 th_cfg_read(&ctx, cfg); | 2035 th_cfg_read(&ctx, cfg); |
2044 th_ioctx_close(&ctx); | 2036 th_ioctx_close(&ctx); |
2045 } | 2037 } |
2046 } | 2038 } |
2039 | |
2040 if (setProxyURI && !argHandleProxyURI(setProxyURI)) | |
2041 goto err_exit; | |
2047 | 2042 |
2048 optNickSep = optNickSepStr ? optNickSepStr[0] : SET_NICK_SEPARATOR; | 2043 optNickSep = optNickSepStr ? optNickSepStr[0] : SET_NICK_SEPARATOR; |
2049 | 2044 |
2050 setBrowser = getenv("BROWSER"); | 2045 setBrowser = getenv("BROWSER"); |
2051 if (setBrowser == NULL) | 2046 if (setBrowser == NULL) |