From 95367b0951421ec0b9ba9fd22323eb75ec91decf Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 22 Aug 2016 02:48:39 +0200 Subject: Corrected an issue that caused the setting inter_configuration/log/log_inter to be ignored Signed-off-by: Haru --- conf/common/inter-server.conf | 4 ++-- src/char/inter.c | 33 ++++++++++++++++++++++++++++++++- src/char/inter.h | 1 + 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/conf/common/inter-server.conf b/conf/common/inter-server.conf index 888d4ad80..18fd9d1e7 100644 --- a/conf/common/inter-server.conf +++ b/conf/common/inter-server.conf @@ -38,10 +38,10 @@ inter_configuration: { // Log Inter Connections, etc.? log_inter: true - // Inter Log Filename + // [UNUSED] Inter Log Filename inter_log_filename: "log/inter.log" - // Log database SQL connection + // [LOGIN, MAP] Log database SQL connection @include "conf/global/sql_connection.conf" } 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 @@ -792,6 +792,34 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) return 1; } +/** + * 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. * @@ -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); }; -- cgit v1.2.3-70-g09d2