From cac8eba5203055178a92511b386f57349bcca506 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 27 Nov 2023 10:27:28 +0100 Subject: [PATCH] html_msg_icon() is full xs_html. --- html.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/html.c b/html.c index 1bbd153..1d540ca 100644 --- a/html.c +++ b/html.c @@ -200,10 +200,11 @@ xs_html *html_actor_icon(xs_dict *actor, const char *date, } -xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) +xs_html *html_msg_icon(const xs_dict *msg) { char *actor_id; xs *actor = NULL; + xs_html *actor_icon = NULL; if ((actor_id = xs_dict_get(msg, "attributedTo")) == NULL) actor_id = xs_dict_get(msg, "actor"); @@ -223,12 +224,10 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) date = xs_dict_get(msg, "published"); udate = xs_dict_get(msg, "updated"); - xs_html *actor_icon = html_actor_icon(actor, date, udate, url, priv); - xs *s1 = xs_html_render(actor_icon); - os = xs_str_cat(os, s1); + actor_icon = html_actor_icon(actor, date, udate, url, priv); } - return os; + return actor_icon; } @@ -1180,16 +1179,17 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, } if (strcmp(type, "Follow") == 0) { - s = xs_str_cat(s, "
\n
\n"); + xs_html *h = xs_html_tag("div", + xs_html_attr("class", "snac-post"), + xs_html_tag("div", + xs_html_attr("class", "snac-post-header"), + xs_html_tag("div", + xs_html_attr("class", "snac-origin"), + xs_html_text(L("follows you"))), + html_msg_icon(msg))); - xs *s1 = xs_fmt("
%s
\n", L("follows you")); - s = xs_str_cat(s, s1); - - s = html_msg_icon(s, msg); - - s = xs_str_cat(s, "
\n
\n"); - - return xs_str_cat(os, s); + xs *s1 = xs_html_render(h); + return xs_str_cat(os, s1); } else if (!xs_match(type, "Note|Question|Page|Article")) { @@ -1306,7 +1306,11 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, } } - s = html_msg_icon(s, msg); + { + xs_html *h = html_msg_icon(msg); + xs *s1 = xs_html_render(h); + s = xs_str_cat(s, s1); + } /* add the content */ s = xs_str_cat(s, "\n
\n"); /** **/