diff options
| author | 2023-11-27 10:27:28 +0100 | |
|---|---|---|
| committer | 2023-11-27 10:27:28 +0100 | |
| commit | cac8eba5203055178a92511b386f57349bcca506 (patch) | |
| tree | c359a64712d8683a104d93274f583db8d15b197a /html.c | |
| parent | Backport from xs. (diff) | |
| download | snac2-cac8eba5203055178a92511b386f57349bcca506.tar.gz snac2-cac8eba5203055178a92511b386f57349bcca506.tar.xz snac2-cac8eba5203055178a92511b386f57349bcca506.zip | |
html_msg_icon() is full xs_html.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 34 |
1 files changed, 19 insertions, 15 deletions
| @@ -200,10 +200,11 @@ xs_html *html_actor_icon(xs_dict *actor, const char *date, | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | 202 | ||
| 203 | xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) | 203 | xs_html *html_msg_icon(const xs_dict *msg) |
| 204 | { | 204 | { |
| 205 | char *actor_id; | 205 | char *actor_id; |
| 206 | xs *actor = NULL; | 206 | xs *actor = NULL; |
| 207 | xs_html *actor_icon = NULL; | ||
| 207 | 208 | ||
| 208 | if ((actor_id = xs_dict_get(msg, "attributedTo")) == NULL) | 209 | if ((actor_id = xs_dict_get(msg, "attributedTo")) == NULL) |
| 209 | actor_id = xs_dict_get(msg, "actor"); | 210 | actor_id = xs_dict_get(msg, "actor"); |
| @@ -223,12 +224,10 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) | |||
| 223 | date = xs_dict_get(msg, "published"); | 224 | date = xs_dict_get(msg, "published"); |
| 224 | udate = xs_dict_get(msg, "updated"); | 225 | udate = xs_dict_get(msg, "updated"); |
| 225 | 226 | ||
| 226 | xs_html *actor_icon = html_actor_icon(actor, date, udate, url, priv); | 227 | actor_icon = html_actor_icon(actor, date, udate, url, priv); |
| 227 | xs *s1 = xs_html_render(actor_icon); | ||
| 228 | os = xs_str_cat(os, s1); | ||
| 229 | } | 228 | } |
| 230 | 229 | ||
| 231 | return os; | 230 | return actor_icon; |
| 232 | } | 231 | } |
| 233 | 232 | ||
| 234 | 233 | ||
| @@ -1180,16 +1179,17 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, | |||
| 1180 | } | 1179 | } |
| 1181 | 1180 | ||
| 1182 | if (strcmp(type, "Follow") == 0) { | 1181 | if (strcmp(type, "Follow") == 0) { |
| 1183 | s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n"); | 1182 | xs_html *h = xs_html_tag("div", |
| 1184 | 1183 | xs_html_attr("class", "snac-post"), | |
| 1185 | xs *s1 = xs_fmt("<div class=\"snac-origin\">%s</div>\n", L("follows you")); | 1184 | xs_html_tag("div", |
| 1186 | s = xs_str_cat(s, s1); | 1185 | xs_html_attr("class", "snac-post-header"), |
| 1187 | 1186 | xs_html_tag("div", | |
| 1188 | s = html_msg_icon(s, msg); | 1187 | xs_html_attr("class", "snac-origin"), |
| 1189 | 1188 | xs_html_text(L("follows you"))), | |
| 1190 | s = xs_str_cat(s, "</div>\n</div>\n"); | 1189 | html_msg_icon(msg))); |
| 1191 | 1190 | ||
| 1192 | return xs_str_cat(os, s); | 1191 | xs *s1 = xs_html_render(h); |
| 1192 | return xs_str_cat(os, s1); | ||
| 1193 | } | 1193 | } |
| 1194 | else | 1194 | else |
| 1195 | if (!xs_match(type, "Note|Question|Page|Article")) { | 1195 | 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, | |||
| 1306 | } | 1306 | } |
| 1307 | } | 1307 | } |
| 1308 | 1308 | ||
| 1309 | s = html_msg_icon(s, msg); | 1309 | { |
| 1310 | xs_html *h = html_msg_icon(msg); | ||
| 1311 | xs *s1 = xs_html_render(h); | ||
| 1312 | s = xs_str_cat(s, s1); | ||
| 1313 | } | ||
| 1310 | 1314 | ||
| 1311 | /* add the content */ | 1315 | /* add the content */ |
| 1312 | s = xs_str_cat(s, "</div>\n<div class=\"e-content snac-content\">\n"); /** **/ | 1316 | s = xs_str_cat(s, "</div>\n<div class=\"e-content snac-content\">\n"); /** **/ |