commit 29b6b5c

default  ·  2023-12-17 15:25:04 +0000 UTC
parent 935c091
Even more is_msg_for_me() updates.
1 files changed,  +8, -3
+8, -3
 1@@ -447,7 +447,8 @@ int is_msg_public(const xs_dict *msg)
 2 int is_msg_for_me(snac *snac, const xs_dict *c_msg)
 3 /* checks if this message is for me */
 4 {
 5-    const char *type = xs_dict_get(c_msg, "type");
 6+    const char *type  = xs_dict_get(c_msg, "type");
 7+    const char *actor = xs_dict_get(c_msg, "actor");
 8 
 9     if (xs_match(type, "Like|Announce")) {
10         const char *object = xs_dict_get(c_msg, "object");
11@@ -464,12 +465,12 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
12             return 2;
13 
14         /* if it's by someone we don't follow, reject */
15-        return following_check(snac, xs_dict_get(c_msg, "actor"));
16+        return following_check(snac, actor);
17     }
18 
19     /* if it's an Undo or an Update, it must be from someone we follow */
20     if (xs_match(type, "Undo|Update")) {
21-        return following_check(snac, xs_dict_get(c_msg, "actor"));
22+        return following_check(snac, actor);
23     }
24 
25     /* if it's not a Create, allow as is */
26@@ -477,6 +478,10 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
27         return 1;
28     }
29 
30+    /* if we follow the Creator of this post, allow */
31+    if (following_check(snac, actor))
32+        return 1;
33+
34     xs_dict *msg = xs_dict_get(c_msg, "object");
35     xs *rcpts = recipient_list(snac, msg, 0);
36     xs_list *p = rcpts;