summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-02 18:16:58 +0200
committerdefault <nobody@localhost>2022-10-02 18:16:58 +0200
commitf82124a705d9c5350b92fba6a03c556c1fd5b2b0 (patch)
tree0382d0058097f25340de8077c5498a46b05736bd /data.c
parent20fd70c01145e6be40edf231781497a2b5ec404f (diff)
The history is shown at the bottom of the local timeline.
Diffstat (limited to 'data.c')
-rw-r--r--data.c31
1 files changed, 31 insertions, 0 deletions
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 */
{