# HG changeset patch # User Matti Hamalainen # Date 1288731125 -7200 # Node ID a4d6707161a72896dfc572009a5805b2743117e8 # Parent 9da39d090ef15fce2313695a4bd092ad992c0110 Add config file option for default setting of ignore mode. diff -r 9da39d090ef1 -r a4d6707161a7 nnchat.c --- a/nnchat.c Tue Nov 02 22:50:32 2010 +0200 +++ b/nnchat.c Tue Nov 02 22:52:05 2010 +0200 @@ -50,7 +50,7 @@ *statusWin = NULL, *editWin = NULL; BOOL setPrvMode = FALSE; -BOOL ignoreMode = FALSE; +BOOL setIgnoreMode = FALSE; qlist_t *nnIgnoreList = NULL; @@ -396,7 +396,7 @@ BOOL logOnly = FALSE; t = nn_strip_tags(s); h = nn_decode_str2(t); - if (ignoreMode) { + if (setIgnoreMode) { qlist_t *node = nnIgnoreList; while (node != NULL) { if (strcasecmp(p2, (char *) node->data) == 0) { @@ -838,6 +838,11 @@ th_cfg_add_string(&tmpcfg, "username", &optUserName, NULL); th_cfg_add_string(&tmpcfg, "password", &optPassword, NULL); th_cfg_add_hexvalue(&tmpcfg, "color", &optUserColor, optUserColor); + + th_cfg_add_comment(&tmpcfg, "Default setting of ignore mode"); + th_cfg_add_boolean(&tmpcfg, "ignore", &setIgnoreMode, setIgnoreMode); + th_cfg_add_comment(&tmpcfg, "People to be ignored when ignore mode is enabled"); + th_cfg_add_string_list(&tmpcfg, "ignore_list", &nnIgnoreList); th_cfg_add_section(&cfg, "general", tmpcfg); tmpcfg = NULL; @@ -847,9 +852,6 @@ th_cfg_add_int(&tmpcfg, "port", &optPort, optPort); th_cfg_add_section(&cfg, "server", tmpcfg); - th_cfg_add_comment(&cfg, "People to be ignored in ignore mode"); - th_cfg_add_string_list(&cfg, "ignores", &nnIgnoreList); - if ((cfgfile = fopen(setConfigFile, "r")) != NULL) th_cfg_read(cfgfile, setConfigFile, cfg); } @@ -1177,8 +1179,8 @@ break; case 0x10c: /* F3 = Ignore mode */ - ignoreMode = !ignoreMode; - printMsg("Ignore mode = %s\n", ignoreMode ? "ON" : "OFF"); + setIgnoreMode = !setIgnoreMode; + printMsg("Ignore mode = %s\n", setIgnoreMode ? "ON" : "OFF"); break; case 0x111: /* F9 = Quit */