summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2023-04-05 23:23:19 +0200
committerGravatar default2023-04-05 23:23:19 +0200
commit5d26f31a8abc3083a22390f6bac99861a5bca77e (patch)
tree5eca7799bc509daef48aade0aa9a049f124c443e /activitypub.c
parentVersion 2.26 RELEASED. (diff)
downloadsnac2-5d26f31a8abc3083a22390f6bac99861a5bca77e.tar.gz
snac2-5d26f31a8abc3083a22390f6bac99861a5bca77e.tar.xz
snac2-5d26f31a8abc3083a22390f6bac99861a5bca77e.zip
Fixed overzealous rejection of Announces.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c11
1 files changed, 10 insertions, 1 deletions
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)
299{ 299{
300 const char *type = xs_dict_get(c_msg, "type"); 300 const char *type = xs_dict_get(c_msg, "type");
301 301
302 /* if it's an Announce by someone we don't follow, reject */
303 if (strcmp(type, "Announce") == 0) { 302 if (strcmp(type, "Announce") == 0) {
303 const char *object = xs_dict_get(c_msg, "object");
304
305 if (xs_type(object) == XSTYPE_DICT)
306 object = xs_dict_get(object, "id");
307
308 /* if it's about one of our posts, accept it */
309 if (xs_startswith(object, snac->actor))
310 return 2;
311
312 /* if it's by someone we don't follow, reject */
304 if (!following_check(snac, xs_dict_get(c_msg, "actor"))) 313 if (!following_check(snac, xs_dict_get(c_msg, "actor")))
305 return 0; 314 return 0;
306 } 315 }