diff --git a/data.c b/data.c index 5de26c1..8c07a7b 100644 --- a/data.c +++ b/data.c @@ -914,6 +914,37 @@ int history_del(snac *snac, char *id) } +d_char *history_list(snac *snac) +{ + d_char *list; + xs *spec; + glob_t globbuf; + + list = xs_list_new(); + spec = xs_fmt("%s/history/" "*.html", snac->basedir); + + if (glob(spec, 0, NULL, &globbuf) == 0) { + int n; + char *fn; + + for (n = 0; (fn = globbuf.gl_pathv[n]) != NULL; n++) { + char *p; + + if ((p = strrchr(fn, '/')) != NULL) { + *p++ = '\0'; + + if (*p != '_') + list = xs_list_append(list, p); + } + } + } + + globfree(&globbuf); + + return list; +} + + void enqueue_input(snac *snac, char *msg, char *req, int retries) /* enqueues an input message */ { diff --git a/html.c b/html.c index ad867af..f36bcfb 100644 --- a/html.c +++ b/html.c @@ -483,6 +483,10 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i xs *actor_o = NULL; char *actor; + /* do not show non-public messages in the public timeline */ + if (local && !is_msg_public(snac, msg)) + return os; + /* return if already seen */ if (xs_set_add(seen, id) == 0) return os; @@ -720,6 +724,31 @@ d_char *html_timeline(snac *snac, char *list, int local) s = xs_str_cat(s, "\n"); + if (local) { + xs *s1 = xs_fmt( + "
%s