From 12aedfadfd9c7805bb7138f64695858b6ceca62c Mon Sep 17 00:00:00 2001 From: default Date: Sun, 5 Feb 2023 13:35:50 +0100 Subject: [PATCH] New function timeline_get(). --- data.c | 7 +++++++ html.c | 2 +- snac.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data.c b/data.c index a5f46e8..0f2bd39 100644 --- a/data.c +++ b/data.c @@ -824,6 +824,13 @@ double timeline_mtime(snac *snac) } +int timeline_get(snac *snac, const char *id, xs_dict **msg) +/* gets a message from the timeline */ +{ + return object_get_by_md5(id, msg, NULL); +} + + int timeline_del(snac *snac, char *id) /* deletes a message from the timeline */ { diff --git a/html.c b/html.c index a91ac76..2f9cf77 100644 --- a/html.c +++ b/html.c @@ -1256,7 +1256,7 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char * while (xs_list_iter(&p, &v)) { xs *msg = NULL; - if (!valid_status(object_get_by_md5(v, &msg, NULL))) + if (!valid_status(timeline_get(&snac, v, &msg))) continue; char *id = xs_dict_get(msg, "id"); diff --git a/snac.h b/snac.h index 7c417cf..b456be7 100644 --- a/snac.h +++ b/snac.h @@ -88,6 +88,7 @@ int follower_check(snac *snac, const char *actor); d_char *follower_list(snac *snac); double timeline_mtime(snac *snac); +int timeline_get(snac *snac, const char *id, xs_dict **msg); 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_list(snac *snac, const char *idx_name, int skip, int show);