Skip to content

Commit

Permalink
Core(impl): skip log filter when log in chat config disabled (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ authored Feb 11, 2024
1 parent 7c81bed commit 9fddfc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/filter/log_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/inc/core/chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct _SrnChat {
};

struct _SrnChatConfig {
bool log; // TODO
bool log;
bool render_mirc_color;
char *password;
GList *auto_run_cmd_list;
Expand Down

0 comments on commit 9fddfc8

Please sign in to comment.