changeset 409:4556174b5be8

Make nickname autocomplete separator configurable.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2012 05:58:15 +0300
parents 65bef93e44e7
children 7ea78f4a4d23
files nnchat.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Thu May 24 05:47:15 2012 +0300
+++ b/nnchat.c	Thu May 24 05:58:15 2012 +0300
@@ -32,6 +32,8 @@
 #define SET_DELAY          (5)
 #endif
 
+#define SET_NICK_SEPARATOR ':'
+
 #define SET_MAX_HISTORY (16)        /* Command history length */
 #define SET_KEEPALIVE   (15*60)     /* Ping/keepalive period in seconds */
 #define SET_MAX_WINDOWS (32)
@@ -51,8 +53,9 @@
         *optPassword = NULL,
         *optPasswordCmd = NULL,
         *optLogFilename = NULL,
-        *optSite = "NN";
-char    optNickSep = ':';
+        *optSite = "NN",
+        *optNickSepStr = NULL;
+char    optNickSep;
 BOOL    optDaemon = FALSE;
 FILE    *optLogFile = NULL;
 BOOL    setIgnoreMode = FALSE;
@@ -1437,6 +1440,7 @@
     th_cfg_add_comment(&tmpcfg, "General settings");
     th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL);
     th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL);
+
     th_cfg_add_comment(&tmpcfg, "Default color as a hex-triplet");
     th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor);
 
@@ -1448,6 +1452,9 @@
     th_cfg_add_comment(&tmpcfg, "Random messages for idle timeout protection. If none are set, plain '.' is used.");
     th_cfg_add_string_list(&tmpcfg, "idle_messages", &setIdleMessages);
 
+    th_cfg_add_comment(&tmpcfg, "Character used as nickname auto-completion separator (default is ':')");
+    th_cfg_add_string(&tmpcfg, "nick_separator", &optNickSepStr, NULL);
+
     th_cfg_add_section(&cfg, "general", tmpcfg);
 
 
@@ -1500,6 +1507,12 @@
         }
     }
 
+    if (optNickSepStr)
+        optNickSep = optNickSepStr[0];
+    else
+        optNickSep = SET_NICK_SEPARATOR;
+
+
     setBrowser = getenv("BROWSER");
     if (setBrowser == NULL)
         setBrowser = "firefox";