diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 23 |
1 files changed, 19 insertions, 4 deletions
| @@ -357,16 +357,19 @@ d_char *timeline_get(snac *snac, char *fn) | |||
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | 359 | ||
| 360 | d_char *timeline_list(snac *snac) | 360 | d_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 | ||
| 396 | d_char *timeline_list(snac *snac, int max) | ||
| 397 | { | ||
| 398 | return _timeline_list(snac, "timeline", max); | ||
| 399 | } | ||
| 400 | |||
| 401 | |||
| 402 | d_char *local_list(snac *snac, int max) | ||
| 403 | { | ||
| 404 | return _timeline_list(snac, "local", max); | ||
| 405 | } | ||
| 406 | |||
| 407 | |||
| 393 | d_char *_timeline_new_fn(snac *snac, char *id) | 408 | d_char *_timeline_new_fn(snac *snac, char *id) |
| 394 | /* creates a new filename */ | 409 | /* creates a new filename */ |
| 395 | { | 410 | { |