From 34a2b47e85351a6fcab123ca0124229d5058c47b Mon Sep 17 00:00:00 2001 From: default Date: Tue, 1 Nov 2022 20:13:23 +0100 Subject: [PATCH] Don't store objects other than 'Note' in timeline_request(). --- activitypub.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/activitypub.c b/activitypub.c index 0ee0bf6..f3c7093 100644 --- a/activitypub.c +++ b/activitypub.c @@ -91,20 +91,24 @@ int timeline_request(snac *snac, char *id, char *referrer) status = activitypub_request(snac, id, &object); if (valid_status(status)) { - char *actor = xs_dict_get(object, "attributedTo"); + char *type = xs_dict_get(object, "type"); - /* request (and drop) the actor for this entry */ - if (!xs_is_null(actor)) - actor_request(snac, actor, NULL); + if (!xs_is_null(type) && strcmp(type, "Note") == 0) { + char *actor = xs_dict_get(object, "attributedTo"); - /* does it have an ancestor? */ - char *in_reply_to = xs_dict_get(object, "inReplyTo"); + /* request (and drop) the actor for this entry */ + if (!xs_is_null(actor)) + actor_request(snac, actor, NULL); - /* recurse! */ - timeline_request(snac, in_reply_to, referrer); + /* does it have an ancestor? */ + char *in_reply_to = xs_dict_get(object, "inReplyTo"); - /* finally store */ - timeline_add(snac, id, object, in_reply_to, referrer); + /* recurse! */ + timeline_request(snac, in_reply_to, referrer); + + /* finally store */ + timeline_add(snac, id, object, in_reply_to, referrer); + } } } }