diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -39,6 +39,14 @@ int cfg_init() { ircstats_config.wordlen_min = 3; } + if(!config_lookup_string(&config, "log_date_format", &ircstats_config.log_date_format)) { + ircstats_config.log_date_format = NULL; + } + + if(!config_lookup_string(&config, "day_date_format", &ircstats_config.day_date_format)) { + ircstats_config.day_date_format = NULL; + } + config_setting_t *regexes_setting = config_lookup(&config, "regexes"); if(!config_setting_is_aggregate(regexes_setting)) { fprintf(stderr, "Setting \"regexes\" must be an aggregate type.\n"); @@ -49,12 +57,24 @@ int cfg_init() { for(int i = 0; i < regex_count; i++) { config_setting_t *re_setting = config_setting_get_elem(regexes_setting, i); - const char *text, *join, *kick; - if(!(config_setting_lookup_string(re_setting, "text", &text) && config_setting_lookup_string(re_setting, "join", &join) && config_setting_lookup_string(re_setting, "kick", &kick))) { + const char *text, *join, *part, *quit, *kick, *nick_changed, *log_opened, *day_changed, *log_date_format, *day_date_format; + if(!(config_setting_lookup_string(re_setting, "text", &text) + && config_setting_lookup_string(re_setting, "join", &join) + && config_setting_lookup_string(re_setting, "part", &part) + && config_setting_lookup_string(re_setting, "quit", &quit) + && config_setting_lookup_string(re_setting, "kick", &kick) + && config_setting_lookup_string(re_setting, "nick_changed", &nick_changed) + && config_setting_lookup_string(re_setting, "log_opened", &log_opened) + && config_setting_lookup_string(re_setting, "day_changed", &day_changed) + )) { fprintf(stderr, "Regex set #%d missing one or more keys.\n", i+1); return 0; } - if(!rs_add(text, join, kick)) + if(!config_setting_lookup_string(re_setting, "log_date_format", &log_date_format)) + log_date_format = NULL; + if(!config_setting_lookup_string(re_setting, "day_date_format", &day_date_format)) + day_date_format = NULL; + if(!rs_add(text, join, part, quit, kick, nick_changed, log_opened, day_changed, log_date_format, day_date_format)) return 0; } @@ -86,7 +106,7 @@ int cfg_init() { } config_setting_t *files = config_setting_get_member(channel_setting, "files"); if(!config_setting_is_aggregate(files)) { - fprintf(stderr, "Setting \"files\" must be an aggregate type (no files added).\n", name); + fprintf(stderr, "Setting \"files\" must be an aggregate type (no files added).\n"); continue; } int file_count = config_setting_length(files); |