commit 04745f5
default
·
2023-12-17 16:07:26 +0000 UTC
parent 9b18d7b
Blah blah blah is_msg_for_me() blah blah blah
1 files changed,
+9,
-5
+9,
-5
1@@ -478,8 +478,10 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
2 return 1;
3 }
4
5- /* if we follow the actor of this post, allow */
6- if (following_check(snac, actor))
7+ int pub_msg = is_msg_public(c_msg);
8+
9+ /* if this message is public and we follow the actor of this post, allow */
10+ if (pub_msg && following_check(snac, actor))
11 return 1;
12
13 xs_dict *msg = xs_dict_get(c_msg, "object");
14@@ -493,14 +495,14 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
15 return 2;
16
17 /* for someone we follow? (probably cc'ed) accept */
18- if (following_check(snac, v))
19+ if (pub_msg && following_check(snac, v))
20 return 5;
21 }
22
23 /* accept if it's by someone we follow */
24 char *atto = xs_dict_get(msg, "attributedTo");
25
26- if (!xs_is_null(atto) && following_check(snac, atto))
27+ if (pub_msg && !xs_is_null(atto) && following_check(snac, atto))
28 return 3;
29
30 /* is this message a reply to another? */
31@@ -513,11 +515,13 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
32 atto = xs_dict_get(r_msg, "attributedTo");
33
34 /* accept if the replied message is from someone we follow */
35- if (!xs_is_null(atto) && following_check(snac, atto))
36+ if (pub_msg && !xs_is_null(atto) && following_check(snac, atto))
37 return 4;
38 }
39 }
40
41+ snac_debug(snac, 0, xs_fmt("is_msg_for_me() final"));
42+
43 return 0;
44 }
45