X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fconf.c;h=2c6f56f9ffa5fd404fd2f10618a241cf42488d6c;hb=27da14ea2abe5680ddfcffbf2a59be5f5a67cecd;hp=a110056d3e1cef926fc9a11bacf4c451ee7ddcd4;hpb=134ce814d444d90c229d0b1777d575bc1effa718;p=umurmur.git diff --git a/src/conf.c b/src/conf.c index a110056..2c6f56f 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2009-2013, Martin Johansson - Copyright (C) 2005-2013, Thorvald Natvig +/* Copyright (C) 2009-2014, Martin Johansson + Copyright (C) 2005-2014, Thorvald Natvig All rights reserved. @@ -84,7 +84,7 @@ const char *getStrConf(param_t param) { config_setting_t *setting = NULL; const char *strsetting = NULL; - + switch (param) { case CERTIFICATE: setting = config_lookup(&configuration, "certificate"); @@ -108,6 +108,17 @@ const char *getStrConf(param_t param) return "/etc/umurmur/private_key.key"; } break; + case CAPATH: + setting = config_lookup(&configuration, "ca_path"); + if (!setting) + return NULL; + else { + if ((strsetting = config_setting_get_string(setting)) != NULL) + return strsetting; + else + return NULL; + } + break; case PASSPHRASE: setting = config_lookup(&configuration, "password"); if (!setting) @@ -217,7 +228,7 @@ const char *getStrConf(param_t param) int getIntConf(param_t param) { config_setting_t *setting = NULL; - + switch (param) { case BINDPORT: setting = config_lookup(&configuration, "bindport"); @@ -267,7 +278,7 @@ int getIntConf(param_t param) bool_t getBoolConf(param_t param) { config_setting_t *setting = NULL; - + switch (param) { case ALLOW_TEXTMESSAGE: setting = config_lookup(&configuration, "allow_textmessage"); @@ -300,33 +311,33 @@ int Conf_getNextChannel(conf_channel_t *chdesc, int index) config_setting_t *setting = NULL; int maxconfig = 64, ret = 0; char configstr[maxconfig]; - + ret = snprintf(configstr, maxconfig, "channels.[%d].name", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL) return -1; /* Required */ chdesc->name = config_setting_get_string(setting); - + ret = snprintf(configstr, maxconfig, "channels.[%d].parent", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL) return -1; /* Required */ chdesc->parent = config_setting_get_string(setting); - + ret = snprintf(configstr, maxconfig, "channels.[%d].description", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ chdesc->description = NULL; else chdesc->description = config_setting_get_string(setting); - + ret = snprintf(configstr, maxconfig, "channels.[%d].password", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ chdesc->password = NULL; else chdesc->password = config_setting_get_string(setting); - + ret = snprintf(configstr, maxconfig, "channels.[%d].noenter", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ @@ -334,6 +345,20 @@ int Conf_getNextChannel(conf_channel_t *chdesc, int index) else chdesc->noenter = config_setting_get_bool(setting); + ret = snprintf(configstr, maxconfig, "channels.[%d].silent", index); + setting = config_lookup(&configuration, configstr); + if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ + chdesc->silent = false; + else + chdesc->silent = config_setting_get_bool(setting); + + ret = snprintf(configstr, maxconfig, "channels.[%d].position", index); + setting = config_lookup(&configuration, configstr); + if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ + chdesc->position = 0; + else + chdesc->position = config_setting_get_int(setting); + return 0; } @@ -342,7 +367,7 @@ int Conf_getNextChannelLink(conf_channel_link_t *chlink, int index) config_setting_t *setting = NULL; int maxconfig = 64, ret = 0; char configstr[maxconfig]; - + ret = snprintf(configstr, maxconfig, "channel_links.[%d].source", index); setting = config_lookup(&configuration, configstr); if (ret >= maxconfig || ret < 0 || setting == NULL)