diff options
author | default <nobody@localhost> | 2023-12-17 17:35:59 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-12-17 17:35:59 +0100 |
commit | cbcd573fb50885382acf7013b5c367a5ea1feb9c (patch) | |
tree | 3f22e090952199af421db207f280613e5c5b889a | |
parent | 04745f5f7d240fe36a7d0a864132ad9fcc4ea4b0 (diff) |
Also check for the .../followers rcpt for non-public messages.
-rw-r--r-- | activitypub.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index 2f7c424..758c1b7 100644 --- a/activitypub.c +++ b/activitypub.c @@ -489,14 +489,36 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) xs_list *p = rcpts; xs_str *v; + xs *actor_followers = NULL; + + if (!pub_msg) { + /* not a public message; get the actor and its followers list */ + xs *actor_obj = NULL; + + if (valid_status(object_get(actor, &actor_obj))) { + if ((v = xs_dict_get(actor_obj, "followers"))) + actor_followers = xs_dup(v); + } + } + while(xs_list_iter(&p, &v)) { /* explicitly for me? accept */ if (strcmp(v, snac->actor) == 0) return 2; - /* for someone we follow? (probably cc'ed) accept */ - if (pub_msg && following_check(snac, v)) - return 5; + if (pub_msg) { + /* a public message for someone we follow? (probably cc'ed) accept */ + if (following_check(snac, v)) + return 5; + } + else + if (actor_followers && strcmp(v, actor_followers) == 0) { + /* if this message is for this actor's followers, are we one of them? */ + if (following_check(snac, actor)) { + snac_debug(snac, 0, xs_fmt("---> non-public msg for followers")); + return 6; + } + } } /* accept if it's by someone we follow */ |