diff --git a/html.c b/html.c index f3f4c91..904a7f3 100644 --- a/html.c +++ b/html.c @@ -392,6 +392,9 @@ d_char *html_top_controls(snac *snac, d_char *s) "

%s:
\n" "

\n" + "

\n" + "

\n" + "

%s:
\n" "

\n" @@ -437,6 +440,8 @@ d_char *html_top_controls(snac *snac, d_char *s) else purge_days = "0"; + const char *d_dm_f_u = xs_dict_get(snac->config, "drop_dm_from_unknown"); + xs *s1 = xs_fmt(_tmpl, snac->actor, L("Sensitive content"), @@ -469,6 +474,8 @@ d_char *html_top_controls(snac *snac, d_char *s) telegram_chat_id, L("Maximum days to keep posts (0: server settings)"), purge_days, + xs_type(d_dm_f_u) == XSTYPE_TRUE ? "checked" : "", + L("Block direct messages from people you don't follow"), L("Password (only to change it)"), L("Repeat Password"), L("Update user info") @@ -1818,6 +1825,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); + } /* avatar upload */ xs_list *avatar_file = xs_dict_get(p_vars, "avatar_file");