More HTML work.

This commit is contained in:
default 2022-09-28 10:40:35 +02:00
parent 5afb60f173
commit 69bc24a4bf

24
html.c
View file

@ -370,16 +370,37 @@ d_char *html_top_controls(snac *snac, d_char *s)
} }
d_char *html_entry(snac *snac, d_char *s, char *msg, xs_set *seen, int level)
{
char *id = xs_dict_get(msg, "id");
/* return if already seen */
if (xs_set_add(seen, id) == 0)
return s;
return s;
}
d_char *html_timeline(snac *snac, char *list, int local) d_char *html_timeline(snac *snac, char *list, int local)
/* returns the HTML for the timeline */ /* returns the HTML for the timeline */
{ {
d_char *s = xs_str_new(NULL); d_char *s = xs_str_new(NULL);
xs_set *seen = xs_set_new(4096);
char *v;
s = html_user_header(snac, s, local); s = html_user_header(snac, s, local);
if (!local) if (!local)
s = html_top_controls(snac, s); s = html_top_controls(snac, s);
while (xs_list_iter(&list, &v)) {
xs *msg = timeline_get(snac, v);
s = html_entry(snac, s, msg, seen, 0);
}
#if 0
s = xs_str_cat(s, "<h1>HI</h1>\n"); s = xs_str_cat(s, "<h1>HI</h1>\n");
s = xs_str_cat(s, xs_fmt("len() == %d\n", xs_list_len(list))); s = xs_str_cat(s, xs_fmt("len() == %d\n", xs_list_len(list)));
@ -392,6 +413,9 @@ d_char *html_timeline(snac *snac, char *list, int local)
} }
s = xs_str_cat(s, "</html>\n"); s = xs_str_cat(s, "</html>\n");
#endif
xs_set_free(seen);
return s; return s;
} }