From d291bb16cab3ed3d7b969ee92893aa79fdd9d23b Mon Sep 17 00:00:00 2001 From: default Date: Sat, 12 Aug 2023 14:03:44 +0200 Subject: Allow a NULL snac struct in html_entry(). --- html.c | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index 5c2c4d7..161292d 100644 --- a/html.c +++ b/html.c @@ -834,7 +834,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch } -xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, +xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, int level, const char *md5, int hide_children) { char *id = xs_dict_get(msg, "id"); @@ -849,7 +849,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, return os; /* hidden? do nothing more for this conversation */ - if (is_hidden(snac, id)) + if (user && is_hidden(user, id)) return os; /* avoid too deep nesting, as it may be a loop */ @@ -891,10 +891,11 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, return os; /* ignore muted morons immediately */ - if (is_muted(snac, actor)) + if (user && is_muted(user, actor)) return os; - if (strcmp(actor, snac->actor) != 0 && !valid_status(actor_get(actor, NULL))) + if ((user == NULL || strcmp(actor, user->actor) != 0) + && !valid_status(actor_get(actor, NULL))) return os; if (level == 0) @@ -904,7 +905,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, s = xs_str_cat(s, "