timeline_top_level() now looks for the entries in the user caches.

This commit is contained in:
default 2023-02-08 13:21:44 +01:00
parent b8cd0d6363
commit 3fcc139d66
3 changed files with 10 additions and 7 deletions

13
data.c
View file

@ -906,11 +906,12 @@ void timeline_admire(snac *snac, char *id, char *admirer, int like)
} }
d_char *timeline_top_level(d_char *list) xs_list *timeline_top_level(snac *snac, xs_list *list)
/* returns the top level md5 entries from this index */ /* returns the top level md5 entries from this index */
{ {
xs_set seen; xs_set seen;
char *p, *v; xs_list *p;
xs_str *v;
xs_set_init(&seen); xs_set_init(&seen);
@ -927,8 +928,10 @@ d_char *timeline_top_level(d_char *list)
if (!object_parent(line, line2, sizeof(line2))) if (!object_parent(line, line2, sizeof(line2)))
break; break;
/* well, there is a parent... but if it's not there, use this */ /* well, there is a parent... but is it here? */
if (!object_here_by_md5(line2)) xs *pfn = timeline_fn_by_md5(snac, line2);
if (pfn == NULL)
break; break;
/* it's here! try again with its own parent */ /* it's here! try again with its own parent */
@ -965,7 +968,7 @@ d_char *timeline_list(snac *snac, const char *idx_name, int skip, int show)
{ {
xs *list = timeline_simple_list(snac, idx_name, skip, show); xs *list = timeline_simple_list(snac, idx_name, skip, show);
return timeline_top_level(list); return timeline_top_level(snac, list);
} }

2
main.c
View file

@ -165,7 +165,7 @@ int main(int argc, char *argv[])
xs *idx = xs_fmt("%s/private.idx", snac.basedir); xs *idx = xs_fmt("%s/private.idx", snac.basedir);
xs *list = index_list_desc(idx, 0, 256); xs *list = index_list_desc(idx, 0, 256);
xs *tl = timeline_top_level(list); xs *tl = timeline_top_level(&snac, list);
xs *j = xs_json_dumps_pp(tl, 4); xs *j = xs_json_dumps_pp(tl, 4);
printf("%s\n", j); printf("%s\n", j);

2
snac.h
View file

@ -99,7 +99,7 @@ d_char *timeline_list(snac *snac, const char *idx_name, int skip, int show);
int timeline_add(snac *snac, char *id, char *o_msg); int timeline_add(snac *snac, char *id, char *o_msg);
void timeline_admire(snac *snac, char *id, char *admirer, int like); void timeline_admire(snac *snac, char *id, char *admirer, int like);
d_char *timeline_top_level(d_char *list); xs_list *timeline_top_level(snac *snac, xs_list *list);
d_char *local_list(snac *snac, int max); d_char *local_list(snac *snac, int max);