diff options
| author | 2022-10-02 18:16:58 +0200 | |
|---|---|---|
| committer | 2022-10-02 18:16:58 +0200 | |
| commit | f82124a705d9c5350b92fba6a03c556c1fd5b2b0 (patch) | |
| tree | 0382d0058097f25340de8077c5498a46b05736bd /data.c | |
| parent | Implemented local timeline cache. (diff) | |
| download | snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.tar.gz snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.tar.xz snac2-f82124a705d9c5350b92fba6a03c556c1fd5b2b0.zip | |
The history is shown at the bottom of the local timeline.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 31 |
1 files changed, 31 insertions, 0 deletions
| @@ -914,6 +914,37 @@ int history_del(snac *snac, char *id) | |||
| 914 | } | 914 | } |
| 915 | 915 | ||
| 916 | 916 | ||
| 917 | d_char *history_list(snac *snac) | ||
| 918 | { | ||
| 919 | d_char *list; | ||
| 920 | xs *spec; | ||
| 921 | glob_t globbuf; | ||
| 922 | |||
| 923 | list = xs_list_new(); | ||
| 924 | spec = xs_fmt("%s/history/" "*.html", snac->basedir); | ||
| 925 | |||
| 926 | if (glob(spec, 0, NULL, &globbuf) == 0) { | ||
| 927 | int n; | ||
| 928 | char *fn; | ||
| 929 | |||
| 930 | for (n = 0; (fn = globbuf.gl_pathv[n]) != NULL; n++) { | ||
| 931 | char *p; | ||
| 932 | |||
| 933 | if ((p = strrchr(fn, '/')) != NULL) { | ||
| 934 | *p++ = '\0'; | ||
| 935 | |||
| 936 | if (*p != '_') | ||
| 937 | list = xs_list_append(list, p); | ||
| 938 | } | ||
| 939 | } | ||
| 940 | } | ||
| 941 | |||
| 942 | globfree(&globbuf); | ||
| 943 | |||
| 944 | return list; | ||
| 945 | } | ||
| 946 | |||
| 947 | |||
| 917 | void enqueue_input(snac *snac, char *msg, char *req, int retries) | 948 | void enqueue_input(snac *snac, char *msg, char *req, int retries) |
| 918 | /* enqueues an input message */ | 949 | /* enqueues an input message */ |
| 919 | { | 950 | { |