summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-12-17 17:07:26 +0100
committerdefault <nobody@localhost>2023-12-17 17:07:26 +0100
commit04745f5f7d240fe36a7d0a864132ad9fcc4ea4b0 (patch)
tree8b2a96104b1361874a6fd7f3e290db153fb66a67 /activitypub.c
parent9b18d7b377630e919aa1e720961ed96eb11422b6 (diff)
Blah blah blah is_msg_for_me() blah blah blah
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c
index 77a496f..2f7c424 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -478,8 +478,10 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
return 1;
}
- /* if we follow the actor of this post, allow */
- if (following_check(snac, actor))
+ int pub_msg = is_msg_public(c_msg);
+
+ /* if this message is public and we follow the actor of this post, allow */
+ if (pub_msg && following_check(snac, actor))
return 1;
xs_dict *msg = xs_dict_get(c_msg, "object");
@@ -493,14 +495,14 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
return 2;
/* for someone we follow? (probably cc'ed) accept */
- if (following_check(snac, v))
+ if (pub_msg && following_check(snac, v))
return 5;
}
/* accept if it's by someone we follow */
char *atto = xs_dict_get(msg, "attributedTo");
- if (!xs_is_null(atto) && following_check(snac, atto))
+ if (pub_msg && !xs_is_null(atto) && following_check(snac, atto))
return 3;
/* is this message a reply to another? */
@@ -513,11 +515,13 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
atto = xs_dict_get(r_msg, "attributedTo");
/* accept if the replied message is from someone we follow */
- if (!xs_is_null(atto) && following_check(snac, atto))
+ if (pub_msg && !xs_is_null(atto) && following_check(snac, atto))
return 4;
}
}
+ snac_debug(snac, 0, xs_fmt("is_msg_for_me() final"));
+
return 0;
}