summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-11-28 20:55:58 +0100
committerGravatar default2023-11-28 20:55:58 +0100
commit230a5487674f38f072833753856da92bf3be74bf (patch)
tree362db0770484a8f848655878e7d943a5d6f23497
parentBlah blah blah html_entry() blah blah blah. (diff)
downloadsnac2-230a5487674f38f072833753856da92bf3be74bf.tar.gz
snac2-230a5487674f38f072833753856da92bf3be74bf.tar.xz
snac2-230a5487674f38f072833753856da92bf3be74bf.zip
html_entry() returns an xs_html.
-rw-r--r--html.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/html.c b/html.c
index e26b9cb..1271a7e 100644
--- a/html.c
+++ b/html.c
@@ -1430,7 +1430,7 @@ xs_html *html_entry_controls(snac *snac, const xs_dict *msg, const char *md5)
1430} 1430}
1431 1431
1432 1432
1433xs_str *html_entry(snac *user, xs_dict *msg, int local, 1433xs_html *html_entry(snac *user, xs_dict *msg, int local,
1434 int level, char *md5, int hide_children) 1434 int level, char *md5, int hide_children)
1435{ 1435{
1436 char *id = xs_dict_get(msg, "id"); 1436 char *id = xs_dict_get(msg, "id");
@@ -1452,7 +1452,7 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
1452 return NULL; 1452 return NULL;
1453 1453
1454 if (strcmp(type, "Follow") == 0) { 1454 if (strcmp(type, "Follow") == 0) {
1455 xs_html *h = xs_html_tag("div", 1455 return xs_html_tag("div",
1456 xs_html_attr("class", "snac-post"), 1456 xs_html_attr("class", "snac-post"),
1457 xs_html_tag("div", 1457 xs_html_tag("div",
1458 xs_html_attr("class", "snac-post-header"), 1458 xs_html_attr("class", "snac-post-header"),
@@ -1460,8 +1460,6 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
1460 xs_html_attr("class", "snac-origin"), 1460 xs_html_attr("class", "snac-origin"),
1461 xs_html_text(L("follows you"))), 1461 xs_html_text(L("follows you"))),
1462 html_msg_icon(msg))); 1462 html_msg_icon(msg)));
1463
1464 return xs_html_render(h);
1465 } 1463 }
1466 else 1464 else
1467 if (!xs_match(type, "Note|Question|Page|Article")) { 1465 if (!xs_match(type, "Note|Question|Page|Article")) {
@@ -2017,15 +2015,15 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
2017 object_get_by_md5(cmd5, &chd); 2015 object_get_by_md5(cmd5, &chd);
2018 2016
2019 if (chd != NULL && xs_is_null(xs_dict_get(chd, "name"))) { 2017 if (chd != NULL && xs_is_null(xs_dict_get(chd, "name"))) {
2020 xs *s1 = html_entry(user, chd, local, level + 1, cmd5, hide_children); 2018 xs_html *che = html_entry(user, chd, local, level + 1, cmd5, hide_children);
2021 2019
2022 if (s1 != NULL) { 2020 if (che != NULL) {
2023 if (left > 3) 2021 if (left > 3)
2024 xs_html_add(ch_older, 2022 xs_html_add(ch_older,
2025 xs_html_raw(s1)); 2023 che);
2026 else 2024 else
2027 xs_html_add(ch_container, 2025 xs_html_add(ch_container,
2028 xs_html_raw(s1)); 2026 che);
2029 } 2027 }
2030 } 2028 }
2031 else 2029 else
@@ -2036,7 +2034,7 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
2036 } 2034 }
2037 } 2035 }
2038 2036
2039 return xs_html_render(entry_top); 2037 return entry_top;
2040} 2038}
2041 2039
2042 2040
@@ -2111,8 +2109,12 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
2111 continue; 2109 continue;
2112 } 2110 }
2113 2111
2114 xs *s1 = html_entry(user, msg, local, 0, v, user ? 0 : 1); 2112 xs_html *entry = html_entry(user, msg, local, 0, v, user ? 0 : 1);
2115 s = xs_str_cat(s, s1); 2113
2114 if (entry != NULL) {
2115 xs *s1 = xs_html_render(entry);
2116 s = xs_str_cat(s, s1);
2117 }
2116 } 2118 }
2117 2119
2118 s = xs_str_cat(s, "</div>\n"); 2120 s = xs_str_cat(s, "</div>\n");
@@ -2435,10 +2437,12 @@ xs_str *html_notifications(snac *snac)
2435 else { 2437 else {
2436 xs *md5 = xs_md5_hex(id, strlen(id)); 2438 xs *md5 = xs_md5_hex(id, strlen(id));
2437 2439
2438 xs *s1 = html_entry(snac, obj, 0, 0, md5, 1); 2440 xs_html *entry = html_entry(snac, obj, 0, 0, md5, 1);
2439 2441
2440 if (s1 != NULL) 2442 if (entry != NULL) {
2443 xs *s1 = xs_html_render(entry);
2441 s = xs_str_cat(s, s1); 2444 s = xs_str_cat(s, s1);
2445 }
2442 } 2446 }
2443 2447
2444 s = xs_str_cat(s, "</div>\n"); 2448 s = xs_str_cat(s, "</div>\n");