aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2026-08-30 16:46:38 +0200
committergrunfink <grunfink@comam.es>2026-08-30 16:46:38 +0200
commit8e521cce1f980edb6ce0bfd490e93e8ab5baa93a (patch)
treeb59611a830dfcdcef3e295748d4167a36d4b7c79
parent61ef7a86183d7d8f5f6a5fcd6d945b91dcb68526 (diff)
Added notification filter for Webmentions.
-rw-r--r--data.c3
-rw-r--r--html.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/data.c b/data.c
index fd6c91f..c38a0b3 100644
--- a/data.c
+++ b/data.c
@@ -3593,6 +3593,7 @@ xs_list *notify_filter_list(snac *snac, xs_list *notifs, int skip, int show)
int n_folreq_on = xs_is_true(xs_dict_get_def(n_filter, "folreqs", n_def));
int n_blocks_on = xs_is_true(xs_dict_get_def(n_filter, "blocks", n_def));
int n_polls_on = xs_is_true(xs_dict_get_def(n_filter, "polls", n_def));
+ int n_webmen_on = xs_is_true(xs_dict_get_def(n_filter, "webmentions", n_def));
const xs_str *v;
xs_list *flt = xs_list_new();
@@ -3633,6 +3634,8 @@ xs_list *notify_filter_list(snac *snac, xs_list *notifs, int skip, int show)
continue;
if (strcmp(type, "Announce") == 0 && !n_ann_on)
continue;
+ if (strcmp(type, "Webmention") == 0 && !n_webmen_on)
+ continue;
if (skip) {
skip--;
diff --git a/html.c b/html.c
index b26c252..3ba48d7 100644
--- a/html.c
+++ b/html.c
@@ -4246,6 +4246,7 @@ void notify_filter(snac *user, const xs_dict *p_vars)
int folreq_on = (v = xs_dict_get(p_vars, "folreqs_on")) ? strcmp(v, "on") == 0 : 0;
int blocks_on = (v = xs_dict_get(p_vars, "blocks_on")) ? strcmp(v, "on") == 0 : 0;
int polls_on = (v = xs_dict_get(p_vars, "polls_on")) ? strcmp(v, "on") == 0 : 0;
+ int webmen_on = (v = xs_dict_get(p_vars, "webmentions_on")) ? strcmp(v, "on") == 0 : 0;
xs *filter = xs_dict_new();
filter = xs_dict_set(filter, "likes", xs_stock(likes_on ? XSTYPE_TRUE : XSTYPE_FALSE));
filter = xs_dict_set(filter, "reacts", xs_stock(reacts_on ? XSTYPE_TRUE : XSTYPE_FALSE));
@@ -4256,6 +4257,7 @@ void notify_filter(snac *user, const xs_dict *p_vars)
filter = xs_dict_set(filter, "folreqs", xs_stock(folreq_on ? XSTYPE_TRUE : XSTYPE_FALSE));
filter = xs_dict_set(filter, "blocks", xs_stock(blocks_on ? XSTYPE_TRUE : XSTYPE_FALSE));
filter = xs_dict_set(filter, "polls", xs_stock(polls_on ? XSTYPE_TRUE : XSTYPE_FALSE));
+ filter = xs_dict_set(filter, "webmentions", xs_stock(webmen_on ? XSTYPE_TRUE : XSTYPE_FALSE));
user->config = xs_dict_set(user->config, "notify_filter", filter);
user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz
}
@@ -4290,6 +4292,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
int n_folreq_on = xs_is_true(xs_dict_get_def(n_filter, "folreqs", n_def));
int n_blocks_on = xs_is_true(xs_dict_get_def(n_filter, "blocks", n_def));
int n_polls_on = xs_is_true(xs_dict_get_def(n_filter, "polls", n_def));
+ int n_webmen_on = xs_is_true(xs_dict_get_def(n_filter, "webmentions", n_def));
xs_html *html = xs_html_tag("html",
html_user_head(user, NULL, NULL),
@@ -4316,6 +4319,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
html_checkbox("folreqs_on", L("Follow requests"), n_folreq_on),
html_checkbox("blocks_on", L("Blocks"), n_blocks_on),
html_checkbox("polls_on", L("Polls"), n_polls_on),
+ html_checkbox("webmentions_on", L("Webmentions"), n_webmen_on),
xs_html_sctag("input",
xs_html_attr("type", "submit"),
xs_html_attr("class", "button"),