From f82124a705d9c5350b92fba6a03c556c1fd5b2b0 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 2 Oct 2022 18:16:58 +0200 Subject: The history is shown at the bottom of the local timeline. --- data.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'data.c') 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 */ { -- cgit v1.2.3