diff options
author | Haru <haru@dotalux.com> | 2016-08-22 02:48:39 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-08-22 03:33:11 +0200 |
commit | 95367b0951421ec0b9ba9fd22323eb75ec91decf (patch) | |
tree | 39dae7d59983fa46c33f987cea8229d430c861cf /src/char | |
parent | 7174ca99be7f0113cb17bf9cb13eba50e4539fc0 (diff) | |
download | hercules-95367b0951421ec0b9ba9fd22323eb75ec91decf.tar.gz hercules-95367b0951421ec0b9ba9fd22323eb75ec91decf.tar.bz2 hercules-95367b0951421ec0b9ba9fd22323eb75ec91decf.tar.xz hercules-95367b0951421ec0b9ba9fd22323eb75ec91decf.zip |
Corrected an issue that caused the setting inter_configuration/log/log_inter to be ignored
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/inter.c | 33 | ||||
-rw-r--r-- | src/char/inter.h | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/char/inter.c b/src/char/inter.c index 4c5eb05e5..05f2bf4f6 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -793,6 +793,34 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) } /** + * Reads the 'inter_configuration/log' config entry and initializes required variables. + * + * @param filename Path to configuration file (used in error and warning messages). + * @param config The current config being parsed. + * @param imported Whether the current config is imported from another file. + * + * @retval false in case of error. + */ +bool inter_config_read_log(const char *filename, const struct config_t *config, bool imported) +{ + const struct config_setting_t *setting = NULL; + + nullpo_retr(false, filename); + nullpo_retr(false, config); + + if ((setting = libconfig->lookup(config, "inter_configuration/log")) == NULL) { + if (imported) + return true; + ShowError("sql_config_read: inter_configuration/log was not found in %s!\n", filename); + return false; + } + + libconfig->setting_lookup_bool_real(setting, "log_inter", &inter->enable_logs); + + return true; +} + +/** * Reads the 'char_configuration/sql_connection' config entry and initializes required variables. * * @param filename Path to configuration file (used in error and warning messages). @@ -854,7 +882,9 @@ bool inter_config_read(const char *filename, bool imported) return false; } libconfig->setting_lookup_int(setting, "party_share_level", &party_share_level); - libconfig->setting_lookup_bool_real(setting, "log_inter", &inter->enable_logs); + + if (!inter->config_read_log(filename, &config, imported)) + retval = false; ShowInfo("Done reading %s.\n", filename); @@ -1418,5 +1448,6 @@ void inter_defaults(void) inter->check_length = inter_check_length; inter->parse_frommap = inter_parse_frommap; inter->final = inter_final; + inter->config_read_log = inter_config_read_log; inter->config_read_connection = inter_config_read_connection; } diff --git a/src/char/inter.h b/src/char/inter.h index 57d1db86c..dbbc6f4e8 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -54,6 +54,7 @@ struct inter_interface { int (*parse_frommap) (int fd); void (*final) (void); bool (*config_read) (const char *filename, bool imported); + bool (*config_read_log) (const char *filename, const struct config_t *config, bool imported); bool (*config_read_connection) (const char *filename, const struct config_t *config, bool imported); }; |