New function timeline_here().

This commit is contained in:
default 2023-02-08 13:28:03 +01:00
parent 3fcc139d66
commit b64d0f338d
2 changed files with 11 additions and 3 deletions

13
data.c
View file

@ -827,6 +827,15 @@ xs_str *timeline_fn_by_md5(snac *snac, const char *md5)
} }
int timeline_here(snac *snac, const char *md5)
/* checks if an object is in the user cache */
{
xs *fn = timeline_fn_by_md5(snac, md5);
return !(fn == NULL);
}
int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg) int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg)
/* gets a message from the timeline */ /* gets a message from the timeline */
{ {
@ -929,9 +938,7 @@ xs_list *timeline_top_level(snac *snac, xs_list *list)
break; break;
/* well, there is a parent... but is it here? */ /* well, there is a parent... but is it here? */
xs *pfn = timeline_fn_by_md5(snac, line2); if (!timeline_here(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 */

1
snac.h
View file

@ -92,6 +92,7 @@ int follower_check(snac *snac, const char *actor);
d_char *follower_list(snac *snac); d_char *follower_list(snac *snac);
double timeline_mtime(snac *snac); double timeline_mtime(snac *snac);
int timeline_here(snac *snac, const char *md5);
int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg); int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg);
int timeline_del(snac *snac, char *id); int timeline_del(snac *snac, char *id);
d_char *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show); d_char *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show);