From ef59df5db2df5cd4fbdae3d33206172192ff72a5 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 17 May 2023 11:47:11 +0200 Subject: [PATCH] Fixed bug in drop_dm_from_unknown web processing. --- html.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/html.c b/html.c index 904a7f3..f4349a3 100644 --- a/html.c +++ b/html.c @@ -1802,6 +1802,8 @@ int html_post_handler(const xs_dict *req, const char *q_path, /* change of user data */ char *v; char *p1, *p2; + xs *byes = xs_val_new(XSTYPE_TRUE); + xs *bno = xs_val_new(XSTYPE_FALSE); if ((v = xs_dict_get(p_vars, "name")) != NULL) snac.config = xs_dict_set(snac.config, "name", v); @@ -1825,10 +1827,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, xs *days = xs_number_new(atof(v)); snac.config = xs_dict_set(snac.config, "purge_days", days); } - if ((v = xs_dict_get(p_vars, "drop_dm_from_unknown")) != NULL) { - xs *yn = xs_val_new(v && strcmp(v, "on") == 0 ? XSTYPE_TRUE : XSTYPE_FALSE); - snac.config = xs_dict_set(snac.config, "drop_dm_from_unknown", yn); - } + if ((v = xs_dict_get(p_vars, "drop_dm_from_unknown")) != NULL && strcmp(v, "on") == 0) + snac.config = xs_dict_set(snac.config, "drop_dm_from_unknown", byes); + else + snac.config = xs_dict_set(snac.config, "drop_dm_from_unknown", bno); /* avatar upload */ xs_list *avatar_file = xs_dict_get(p_vars, "avatar_file");