snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 69bc24a4bf188b0d504cfaa1350d9381ed45eb89
parent 5afb60f173dd1a266d023bb6568ca127ab6ea4b1
Author: default <nobody@localhost>
Date:   Wed, 28 Sep 2022 10:40:35 +0200

More HTML work.

Diffstat:
Mhtml.c | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/html.c b/html.c @@ -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) /* returns the HTML for the timeline */ { d_char *s = xs_str_new(NULL); + xs_set *seen = xs_set_new(4096); + char *v; s = html_user_header(snac, s, local); if (!local) 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, 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"); +#endif + + xs_set_free(seen); return s; }