Mercurial > hg > nnchat
comparison nnchat.c @ 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 |
comparison
equal
deleted
inserted
replaced
408:65bef93e44e7 | 409:4556174b5be8 |
---|---|
30 #define SET_CONFIG_FILE ".nnchat" | 30 #define SET_CONFIG_FILE ".nnchat" |
31 #define SET_DIR_SEPARATOR "/" | 31 #define SET_DIR_SEPARATOR "/" |
32 #define SET_DELAY (5) | 32 #define SET_DELAY (5) |
33 #endif | 33 #endif |
34 | 34 |
35 #define SET_NICK_SEPARATOR ':' | |
36 | |
35 #define SET_MAX_HISTORY (16) /* Command history length */ | 37 #define SET_MAX_HISTORY (16) /* Command history length */ |
36 #define SET_KEEPALIVE (15*60) /* Ping/keepalive period in seconds */ | 38 #define SET_KEEPALIVE (15*60) /* Ping/keepalive period in seconds */ |
37 #define SET_MAX_WINDOWS (32) | 39 #define SET_MAX_WINDOWS (32) |
38 | 40 |
39 | 41 |
49 *optUserNameCmd = NULL, | 51 *optUserNameCmd = NULL, |
50 *optUserNameEnc = NULL, | 52 *optUserNameEnc = NULL, |
51 *optPassword = NULL, | 53 *optPassword = NULL, |
52 *optPasswordCmd = NULL, | 54 *optPasswordCmd = NULL, |
53 *optLogFilename = NULL, | 55 *optLogFilename = NULL, |
54 *optSite = "NN"; | 56 *optSite = "NN", |
55 char optNickSep = ':'; | 57 *optNickSepStr = NULL; |
58 char optNickSep; | |
56 BOOL optDaemon = FALSE; | 59 BOOL optDaemon = FALSE; |
57 FILE *optLogFile = NULL; | 60 FILE *optLogFile = NULL; |
58 BOOL setIgnoreMode = FALSE; | 61 BOOL setIgnoreMode = FALSE; |
59 BOOL optDebug = FALSE; | 62 BOOL optDebug = FALSE; |
60 BOOL optLogEnable = FALSE; | 63 BOOL optLogEnable = FALSE; |
1435 /* Read configuration file */ | 1438 /* Read configuration file */ |
1436 tmpcfg = NULL; | 1439 tmpcfg = NULL; |
1437 th_cfg_add_comment(&tmpcfg, "General settings"); | 1440 th_cfg_add_comment(&tmpcfg, "General settings"); |
1438 th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL); | 1441 th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL); |
1439 th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL); | 1442 th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL); |
1443 | |
1440 th_cfg_add_comment(&tmpcfg, "Default color as a hex-triplet"); | 1444 th_cfg_add_comment(&tmpcfg, "Default color as a hex-triplet"); |
1441 th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor); | 1445 th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor); |
1442 | 1446 |
1443 th_cfg_add_comment(&tmpcfg, "Default setting of ignore mode"); | 1447 th_cfg_add_comment(&tmpcfg, "Default setting of ignore mode"); |
1444 th_cfg_add_bool(&tmpcfg, "ignore", &setIgnoreMode, setIgnoreMode); | 1448 th_cfg_add_bool(&tmpcfg, "ignore", &setIgnoreMode, setIgnoreMode); |
1445 th_cfg_add_comment(&tmpcfg, "People to be ignored when ignore mode is enabled"); | 1449 th_cfg_add_comment(&tmpcfg, "People to be ignored when ignore mode is enabled"); |
1446 th_cfg_add_string_list(&tmpcfg, "ignore_list", &setIgnoreList); | 1450 th_cfg_add_string_list(&tmpcfg, "ignore_list", &setIgnoreList); |
1447 | 1451 |
1448 th_cfg_add_comment(&tmpcfg, "Random messages for idle timeout protection. If none are set, plain '.' is used."); | 1452 th_cfg_add_comment(&tmpcfg, "Random messages for idle timeout protection. If none are set, plain '.' is used."); |
1449 th_cfg_add_string_list(&tmpcfg, "idle_messages", &setIdleMessages); | 1453 th_cfg_add_string_list(&tmpcfg, "idle_messages", &setIdleMessages); |
1454 | |
1455 th_cfg_add_comment(&tmpcfg, "Character used as nickname auto-completion separator (default is ':')"); | |
1456 th_cfg_add_string(&tmpcfg, "nick_separator", &optNickSepStr, NULL); | |
1450 | 1457 |
1451 th_cfg_add_section(&cfg, "general", tmpcfg); | 1458 th_cfg_add_section(&cfg, "general", tmpcfg); |
1452 | 1459 |
1453 | 1460 |
1454 tmpcfg = NULL; | 1461 tmpcfg = NULL; |
1497 { | 1504 { |
1498 th_cfg_read(cfgfile, setConfigFile, cfg); | 1505 th_cfg_read(cfgfile, setConfigFile, cfg); |
1499 fclose(cfgfile); | 1506 fclose(cfgfile); |
1500 } | 1507 } |
1501 } | 1508 } |
1509 | |
1510 if (optNickSepStr) | |
1511 optNickSep = optNickSepStr[0]; | |
1512 else | |
1513 optNickSep = SET_NICK_SEPARATOR; | |
1514 | |
1502 | 1515 |
1503 setBrowser = getenv("BROWSER"); | 1516 setBrowser = getenv("BROWSER"); |
1504 if (setBrowser == NULL) | 1517 if (setBrowser == NULL) |
1505 setBrowser = "firefox"; | 1518 setBrowser = "firefox"; |
1506 | 1519 |