diff --git a/html.c b/html.c index d00ba66..37dc5c7 100644 --- a/html.c +++ b/html.c @@ -1430,8 +1430,8 @@ xs_html *html_entry_controls(snac *snac, const xs_dict *msg, const char *md5) } -xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, - int level, const char *md5, int hide_children) +xs_str *html_entry(snac *user, xs_dict *msg, int local, + int level, char *md5, int hide_children) { char *id = xs_dict_get(msg, "id"); char *type = xs_dict_get(msg, "type"); @@ -1442,15 +1442,15 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, /* do not show non-public messages in the public timeline */ if ((local || !user) && !is_msg_public(msg)) - return os; + return NULL; /* hidden? do nothing more for this conversation */ if (user && is_hidden(user, id)) - return os; + return NULL; /* avoid too deep nesting, as it may be a loop */ if (level >= 256) - return os; + return NULL; if (strcmp(type, "Follow") == 0) { xs_html *h = xs_html_tag("div", @@ -1462,32 +1462,31 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, xs_html_text(L("follows you"))), html_msg_icon(msg))); - xs *s1 = xs_html_render(h); - return xs_str_cat(os, s1); + return xs_html_render(h); } else if (!xs_match(type, "Note|Question|Page|Article")) { /* skip oddities */ - return os; + return NULL; } /* ignore notes with "name", as they are votes to Questions */ if (strcmp(type, "Note") == 0 && !xs_is_null(xs_dict_get(msg, "name"))) - return os; + return NULL; /* bring the main actor */ if ((actor = xs_dict_get(msg, "attributedTo")) == NULL) - return os; + return NULL; /* ignore muted morons immediately */ if (user && is_muted(user, actor)) - return os; + return NULL; if ((user == NULL || strcmp(actor, user->actor) != 0) && !valid_status(actor_get(actor, NULL))) - return os; + return NULL; - xs *s = xs_str_new("