Mercurial > hg > nnchat
comparison nnchat.c @ 149:a4d6707161a7
Add config file option for default setting of ignore mode.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Nov 2010 22:52:05 +0200 |
parents | 9da39d090ef1 |
children | db5e7a1f1eb3 |
comparison
equal
deleted
inserted
replaced
148:9da39d090ef1 | 149:a4d6707161a7 |
---|---|
48 FILE *optLogFile = NULL; | 48 FILE *optLogFile = NULL; |
49 WINDOW *mainWin = NULL, | 49 WINDOW *mainWin = NULL, |
50 *statusWin = NULL, | 50 *statusWin = NULL, |
51 *editWin = NULL; | 51 *editWin = NULL; |
52 BOOL setPrvMode = FALSE; | 52 BOOL setPrvMode = FALSE; |
53 BOOL ignoreMode = FALSE; | 53 BOOL setIgnoreMode = FALSE; |
54 | 54 |
55 | 55 |
56 qlist_t *nnIgnoreList = NULL; | 56 qlist_t *nnIgnoreList = NULL; |
57 nn_userhash_t *nnUsers = NULL; | 57 nn_userhash_t *nnUsers = NULL; |
58 char *setConfigFile = NULL, | 58 char *setConfigFile = NULL, |
394 } else { | 394 } else { |
395 BOOL isMine = strcmp(p2, optUserName) == 0; | 395 BOOL isMine = strcmp(p2, optUserName) == 0; |
396 BOOL logOnly = FALSE; | 396 BOOL logOnly = FALSE; |
397 t = nn_strip_tags(s); | 397 t = nn_strip_tags(s); |
398 h = nn_decode_str2(t); | 398 h = nn_decode_str2(t); |
399 if (ignoreMode) { | 399 if (setIgnoreMode) { |
400 qlist_t *node = nnIgnoreList; | 400 qlist_t *node = nnIgnoreList; |
401 while (node != NULL) { | 401 while (node != NULL) { |
402 if (strcasecmp(p2, (char *) node->data) == 0) { | 402 if (strcasecmp(p2, (char *) node->data) == 0) { |
403 logOnly = TRUE; | 403 logOnly = TRUE; |
404 break; | 404 break; |
836 tmpcfg = NULL; | 836 tmpcfg = NULL; |
837 th_cfg_add_comment(&tmpcfg, "General settings"); | 837 th_cfg_add_comment(&tmpcfg, "General settings"); |
838 th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL); | 838 th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL); |
839 th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL); | 839 th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL); |
840 th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor); | 840 th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor); |
841 | |
842 th_cfg_add_comment(&tmpcfg, "Default setting of ignore mode"); | |
843 th_cfg_add_boolean(&tmpcfg, "ignore", &setIgnoreMode, setIgnoreMode); | |
844 th_cfg_add_comment(&tmpcfg, "People to be ignored when ignore mode is enabled"); | |
845 th_cfg_add_string_list(&tmpcfg, "ignore_list", &nnIgnoreList); | |
841 th_cfg_add_section(&cfg, "general", tmpcfg); | 846 th_cfg_add_section(&cfg, "general", tmpcfg); |
842 | 847 |
843 tmpcfg = NULL; | 848 tmpcfg = NULL; |
844 th_cfg_add_comment(&tmpcfg, "Chat server hostname or IP address"); | 849 th_cfg_add_comment(&tmpcfg, "Chat server hostname or IP address"); |
845 th_cfg_add_string(&tmpcfg, "host", &optServer, optServer); | 850 th_cfg_add_string(&tmpcfg, "host", &optServer, optServer); |
846 th_cfg_add_comment(&tmpcfg, "Default port to connect to (8002 = public room, 8003 = passion pit, 8005 = members only)"); | 851 th_cfg_add_comment(&tmpcfg, "Default port to connect to (8002 = public room, 8003 = passion pit, 8005 = members only)"); |
847 th_cfg_add_int(&tmpcfg, "port", &optPort, optPort); | 852 th_cfg_add_int(&tmpcfg, "port", &optPort, optPort); |
848 th_cfg_add_section(&cfg, "server", tmpcfg); | 853 th_cfg_add_section(&cfg, "server", tmpcfg); |
849 | |
850 th_cfg_add_comment(&cfg, "People to be ignored in ignore mode"); | |
851 th_cfg_add_string_list(&cfg, "ignores", &nnIgnoreList); | |
852 | 854 |
853 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) | 855 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) |
854 th_cfg_read(cfgfile, setConfigFile, cfg); | 856 th_cfg_read(cfgfile, setConfigFile, cfg); |
855 } | 857 } |
856 | 858 |
1175 nn_editbuf_clear(editBuf); | 1177 nn_editbuf_clear(editBuf); |
1176 update = TRUE; | 1178 update = TRUE; |
1177 break; | 1179 break; |
1178 | 1180 |
1179 case 0x10c: /* F3 = Ignore mode */ | 1181 case 0x10c: /* F3 = Ignore mode */ |
1180 ignoreMode = !ignoreMode; | 1182 setIgnoreMode = !setIgnoreMode; |
1181 printMsg("Ignore mode = %s\n", ignoreMode ? "ON" : "OFF"); | 1183 printMsg("Ignore mode = %s\n", setIgnoreMode ? "ON" : "OFF"); |
1182 break; | 1184 break; |
1183 | 1185 |
1184 case 0x111: /* F9 = Quit */ | 1186 case 0x111: /* F9 = Quit */ |
1185 printMsg("Quitting per user request.\n"); | 1187 printMsg("Quitting per user request.\n"); |
1186 exitProg = TRUE; | 1188 exitProg = TRUE; |