summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/config.c b/config.c
index 2cb6aa6..84bcf39 100644
--- a/config.c
+++ b/config.c
@@ -27,10 +27,6 @@ int cfg_init() {
return 0;
}
- if(!config_lookup_int(&config, "threads", &ircstats_config.threads)) {
- ircstats_config.threads = 1;
- }
-
if(!config_lookup_int(&config, "monolog_min", &ircstats_config.monolog_min)) {
ircstats_config.monolog_min = 5;
}
@@ -39,6 +35,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 +53,28 @@ 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)
+ )) {
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, "day_changed", &day_changed)) {
+ day_changed = NULL;
+ }
+
+ 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);