From afbb9e24a33bc6e1433658f69b2f2b0784e8467c Mon Sep 17 00:00:00 2001 From: Shengyu Zhang Date: Sun, 11 Feb 2024 14:05:24 +0800 Subject: [PATCH] Core(impl): skip log filter when log in chat config disabled --- src/config/reader.c | 1 + src/filter/log_filter.c | 4 ++++ src/inc/core/chat.h | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/reader.c b/src/config/reader.c index 4fad9f8d..d443e42c 100644 --- a/src/config/reader.c +++ b/src/config/reader.c @@ -491,6 +491,7 @@ static SrnRet read_server_config_from_cfg(config_t *cfg, SrnServerConfig *srv_cf } static SrnRet read_chat_config_from_chat(config_setting_t *chat, SrnChatConfig *cfg){ + config_setting_lookup_bool_ex(chat, "log", &cfg->log); config_setting_lookup_bool_ex(chat, "notify", &cfg->ui->notify); config_setting_lookup_bool_ex(chat, "show-topic", &cfg->ui->show_topic); config_setting_lookup_bool_ex(chat, "show-avatar", &cfg->ui->show_avatar); diff --git a/src/filter/log_filter.c b/src/filter/log_filter.c index c6c621e5..6ce6dc89 100644 --- a/src/filter/log_filter.c +++ b/src/filter/log_filter.c @@ -53,6 +53,10 @@ bool filter(const SrnMessage *msg) { char *file; GString *basename; + if (!msg->chat->cfg->log) { + return TRUE; + } + date_str = g_date_time_format(msg->time, "%F"); g_return_val_if_fail(date_str, TRUE); diff --git a/src/inc/core/chat.h b/src/inc/core/chat.h index 73de434e..43cd6c42 100644 --- a/src/inc/core/chat.h +++ b/src/inc/core/chat.h @@ -70,7 +70,7 @@ struct _SrnChat { }; struct _SrnChatConfig { - bool log; // TODO + bool log; bool render_mirc_color; char *password; GList *auto_run_cmd_list;