commit 5d26f31

default  ·  2023-04-05 21:23:19 +0000 UTC
parent 1cdd6d1
Fixed overzealous rejection of Announces.
2 files changed,  +11, -2
M snac.h
+10, -1
 1@@ -299,8 +299,17 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg)
 2 {
 3     const char *type = xs_dict_get(c_msg, "type");
 4 
 5-    /* if it's an Announce by someone we don't follow, reject */
 6     if (strcmp(type, "Announce") == 0) {
 7+        const char *object = xs_dict_get(c_msg, "object");
 8+
 9+        if (xs_type(object) == XSTYPE_DICT)
10+            object = xs_dict_get(object, "id");
11+
12+        /* if it's about one of our posts, accept it */
13+        if (xs_startswith(object, snac->actor))
14+            return 2;
15+
16+        /* if it's by someone we don't follow, reject */
17         if (!following_check(snac, xs_dict_get(c_msg, "actor")))
18             return 0;
19     }
M snac.h
+1, -1
1@@ -1,7 +1,7 @@
2 /* snac - A simple, minimalistic ActivityPub instance */
3 /* copyright (c) 2022 - 2023 grunfink / MIT license */
4 
5-#define VERSION "2.26"
6+#define VERSION "2.27-dev"
7 
8 #define USER_AGENT "snac/" VERSION
9