comparison main.c @ 602:4bae14092b78

Add parameters (unused for now) for proxy password etc. in case SOCKS 5 support is ever added.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 May 2014 01:04:30 +0300
parents e661d7654e23
children 0a30bf8db004
comparison
equal deleted inserted replaced
601:e661d7654e23 602:4bae14092b78
61 optProxyPort = 1080, 61 optProxyPort = 1080,
62 optProxyType = NN_PROXY_NONE; 62 optProxyType = NN_PROXY_NONE;
63 int optUserColor = 0x000000; 63 int optUserColor = 0x000000;
64 char *optServer = "chat.newbienudes.com", 64 char *optServer = "chat.newbienudes.com",
65 *optProxyServer = NULL, 65 *optProxyServer = NULL,
66 *optProxyUserID = NULL,
67 *optProxyPassword = NULL,
66 *optUserName = NULL, 68 *optUserName = NULL,
67 *optUserNameCmd = NULL, 69 *optUserNameCmd = NULL,
68 *optUserNameEnc = NULL, 70 *optUserNameEnc = NULL,
69 *optPassword = NULL, 71 *optPassword = NULL,
70 *optPasswordCmd = NULL, 72 *optPasswordCmd = NULL,
1867 th_cfg_add_int(&tmpcfg, "type", &optProxyType, optProxyType); 1869 th_cfg_add_int(&tmpcfg, "type", &optProxyType, optProxyType);
1868 th_cfg_add_comment(&tmpcfg, "Proxy server host name"); 1870 th_cfg_add_comment(&tmpcfg, "Proxy server host name");
1869 th_cfg_add_string(&tmpcfg, "host", &optProxyServer, optProxyServer); 1871 th_cfg_add_string(&tmpcfg, "host", &optProxyServer, optProxyServer);
1870 th_cfg_add_comment(&tmpcfg, "Proxy port, 1080 is the standard SOCKS port"); 1872 th_cfg_add_comment(&tmpcfg, "Proxy port, 1080 is the standard SOCKS port");
1871 th_cfg_add_int(&tmpcfg, "port", &optProxyPort, optProxyPort); 1873 th_cfg_add_int(&tmpcfg, "port", &optProxyPort, optProxyPort);
1874 th_cfg_add_comment(&tmpcfg, "Proxy user ID");
1875 th_cfg_add_string(&tmpcfg, "userid", &optProxyUserID, optProxyUserID);
1876 // th_cfg_add_comment(&tmpcfg, "Proxy password (only available for SOCKS 5)");
1877 // th_cfg_add_string(&tmpcfg, "password", &optProxyPassword, optProxyPassword);
1872 th_cfg_add_section(&cfg, "proxy", tmpcfg); 1878 th_cfg_add_section(&cfg, "proxy", tmpcfg);
1873 1879
1874 1880
1875 tmpcfg = NULL; 1881 tmpcfg = NULL;
1876 th_cfg_add_comment(&tmpcfg, "Enable logging"); 1882 th_cfg_add_comment(&tmpcfg, "Enable logging");
2061 editState.conn = conn; 2067 editState.conn = conn;
2062 2068
2063 // Are we using a proxy? 2069 // Are we using a proxy?
2064 if (optProxyType != NN_PROXY_NONE && optProxyServer != NULL) 2070 if (optProxyType != NN_PROXY_NONE && optProxyServer != NULL)
2065 { 2071 {
2066 if (nn_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer, NULL) != 0) 2072 if (optProxyUserID == NULL)
2073 optProxyUserID = "James Bond";
2074
2075 if (nn_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer,
2076 optProxyUserID, optProxyPassword) != 0)
2067 { 2077 {
2068 errorMsg("Error setting proxy information.\n"); 2078 errorMsg("Error setting proxy information.\n");
2069 goto err_exit; 2079 goto err_exit;
2070 } 2080 }
2071 } 2081 }