diff 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
line wrap: on
line diff
--- a/main.c	Tue May 20 00:09:45 2014 +0300
+++ b/main.c	Tue May 20 01:04:30 2014 +0300
@@ -63,6 +63,8 @@
 int     optUserColor = 0x000000;
 char    *optServer = "chat.newbienudes.com",
         *optProxyServer = NULL,
+        *optProxyUserID = NULL,
+        *optProxyPassword = NULL,
         *optUserName = NULL,
         *optUserNameCmd = NULL,
         *optUserNameEnc = NULL,
@@ -1869,6 +1871,10 @@
     th_cfg_add_string(&tmpcfg, "host", &optProxyServer, optProxyServer);
     th_cfg_add_comment(&tmpcfg, "Proxy port, 1080 is the standard SOCKS port");
     th_cfg_add_int(&tmpcfg, "port", &optProxyPort, optProxyPort);
+    th_cfg_add_comment(&tmpcfg, "Proxy user ID");
+    th_cfg_add_string(&tmpcfg, "userid", &optProxyUserID, optProxyUserID);
+//    th_cfg_add_comment(&tmpcfg, "Proxy password (only available for SOCKS 5)");
+//    th_cfg_add_string(&tmpcfg, "password", &optProxyPassword, optProxyPassword);
     th_cfg_add_section(&cfg, "proxy", tmpcfg);
 
 
@@ -2063,7 +2069,11 @@
     // Are we using a proxy?
     if (optProxyType != NN_PROXY_NONE && optProxyServer != NULL)
     {
-        if (nn_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer, NULL) != 0)
+        if (optProxyUserID == NULL)
+            optProxyUserID = "James Bond";
+
+        if (nn_conn_set_proxy(conn, optProxyType, optProxyPort, optProxyServer,
+            optProxyUserID, optProxyPassword) != 0)
         {
             errorMsg("Error setting proxy information.\n");
             goto err_exit;