summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'data.c')
-rw-r--r--data.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/data.c b/data.c
index 97cf8b4..6ea1bae 100644
--- a/data.c
+++ b/data.c
@@ -357,16 +357,19 @@ d_char *timeline_get(snac *snac, char *fn)
357} 357}
358 358
359 359
360d_char *timeline_list(snac *snac) 360d_char *_timeline_list(snac *snac, char *directory, int max)
361/* returns a list of the timeline filenames */ 361/* returns a list of the timeline filenames */
362{ 362{
363 d_char *list; 363 d_char *list;
364 xs *spec = xs_fmt("%s/timeline/" "*.json", snac->basedir); 364 xs *spec = xs_fmt("%s/%s/" "*.json", snac->basedir, directory);
365 glob_t globbuf; 365 glob_t globbuf;
366 int max; 366 int c_max;
367 367
368 /* maximum number of items in the timeline */ 368 /* maximum number of items in the timeline */
369 max = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries")); 369 c_max = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
370
371 if (max > c_max)
372 max = c_max;
370 373
371 list = xs_list_new(); 374 list = xs_list_new();
372 375
@@ -390,6 +393,18 @@ d_char *timeline_list(snac *snac)
390} 393}
391 394
392 395
396d_char *timeline_list(snac *snac, int max)
397{
398 return _timeline_list(snac, "timeline", max);
399}
400
401
402d_char *local_list(snac *snac, int max)
403{
404 return _timeline_list(snac, "local", max);
405}
406
407
393d_char *_timeline_new_fn(snac *snac, char *id) 408d_char *_timeline_new_fn(snac *snac, char *id)
394/* creates a new filename */ 409/* creates a new filename */
395{ 410{