mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
html_entry() returns an xs_html.
This commit is contained in:
parent
89b796f941
commit
230a548767
1 changed files with 17 additions and 13 deletions
28
html.c
28
html.c
|
@ -1430,7 +1430,7 @@ xs_html *html_entry_controls(snac *snac, const xs_dict *msg, const char *md5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_str *html_entry(snac *user, xs_dict *msg, int local,
|
xs_html *html_entry(snac *user, xs_dict *msg, int local,
|
||||||
int level, char *md5, int hide_children)
|
int level, char *md5, int hide_children)
|
||||||
{
|
{
|
||||||
char *id = xs_dict_get(msg, "id");
|
char *id = xs_dict_get(msg, "id");
|
||||||
|
@ -1452,7 +1452,7 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strcmp(type, "Follow") == 0) {
|
if (strcmp(type, "Follow") == 0) {
|
||||||
xs_html *h = xs_html_tag("div",
|
return xs_html_tag("div",
|
||||||
xs_html_attr("class", "snac-post"),
|
xs_html_attr("class", "snac-post"),
|
||||||
xs_html_tag("div",
|
xs_html_tag("div",
|
||||||
xs_html_attr("class", "snac-post-header"),
|
xs_html_attr("class", "snac-post-header"),
|
||||||
|
@ -1460,8 +1460,6 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
|
||||||
xs_html_attr("class", "snac-origin"),
|
xs_html_attr("class", "snac-origin"),
|
||||||
xs_html_text(L("follows you"))),
|
xs_html_text(L("follows you"))),
|
||||||
html_msg_icon(msg)));
|
html_msg_icon(msg)));
|
||||||
|
|
||||||
return xs_html_render(h);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!xs_match(type, "Note|Question|Page|Article")) {
|
if (!xs_match(type, "Note|Question|Page|Article")) {
|
||||||
|
@ -2017,15 +2015,15 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
|
||||||
object_get_by_md5(cmd5, &chd);
|
object_get_by_md5(cmd5, &chd);
|
||||||
|
|
||||||
if (chd != NULL && xs_is_null(xs_dict_get(chd, "name"))) {
|
if (chd != NULL && xs_is_null(xs_dict_get(chd, "name"))) {
|
||||||
xs *s1 = html_entry(user, chd, local, level + 1, cmd5, hide_children);
|
xs_html *che = html_entry(user, chd, local, level + 1, cmd5, hide_children);
|
||||||
|
|
||||||
if (s1 != NULL) {
|
if (che != NULL) {
|
||||||
if (left > 3)
|
if (left > 3)
|
||||||
xs_html_add(ch_older,
|
xs_html_add(ch_older,
|
||||||
xs_html_raw(s1));
|
che);
|
||||||
else
|
else
|
||||||
xs_html_add(ch_container,
|
xs_html_add(ch_container,
|
||||||
xs_html_raw(s1));
|
che);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2036,7 +2034,7 @@ xs_str *html_entry(snac *user, xs_dict *msg, int local,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xs_html_render(entry_top);
|
return entry_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2111,9 +2109,13 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
xs *s1 = html_entry(user, msg, local, 0, v, user ? 0 : 1);
|
xs_html *entry = html_entry(user, msg, local, 0, v, user ? 0 : 1);
|
||||||
|
|
||||||
|
if (entry != NULL) {
|
||||||
|
xs *s1 = xs_html_render(entry);
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s = xs_str_cat(s, "</div>\n");
|
s = xs_str_cat(s, "</div>\n");
|
||||||
|
|
||||||
|
@ -2435,11 +2437,13 @@ xs_str *html_notifications(snac *snac)
|
||||||
else {
|
else {
|
||||||
xs *md5 = xs_md5_hex(id, strlen(id));
|
xs *md5 = xs_md5_hex(id, strlen(id));
|
||||||
|
|
||||||
xs *s1 = html_entry(snac, obj, 0, 0, md5, 1);
|
xs_html *entry = html_entry(snac, obj, 0, 0, md5, 1);
|
||||||
|
|
||||||
if (s1 != NULL)
|
if (entry != NULL) {
|
||||||
|
xs *s1 = xs_html_render(entry);
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s = xs_str_cat(s, "</div>\n");
|
s = xs_str_cat(s, "</div>\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue