From 5d26f31a8abc3083a22390f6bac99861a5bca77e Mon Sep 17 00:00:00 2001 From: default Date: Wed, 5 Apr 2023 23:23:19 +0200 Subject: Fixed overzealous rejection of Announces. --- activitypub.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'activitypub.c') diff --git a/activitypub.c b/activitypub.c index b21120f..0caf970 100644 --- a/activitypub.c +++ b/activitypub.c @@ -299,8 +299,17 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg) { const char *type = xs_dict_get(c_msg, "type"); - /* if it's an Announce by someone we don't follow, reject */ if (strcmp(type, "Announce") == 0) { + const char *object = xs_dict_get(c_msg, "object"); + + if (xs_type(object) == XSTYPE_DICT) + object = xs_dict_get(object, "id"); + + /* if it's about one of our posts, accept it */ + if (xs_startswith(object, snac->actor)) + return 2; + + /* if it's by someone we don't follow, reject */ if (!following_check(snac, xs_dict_get(c_msg, "actor"))) return 0; } -- cgit v1.2.3