diff options
author | default <nobody@localhost> | 2023-12-18 11:37:02 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-12-18 11:37:02 +0100 |
commit | 52f27123bbd6cf8101a86618c6aa04f52a07543a (patch) | |
tree | 693ebd30feb613f0829c13bf2ae53bfe6c46ba2b | |
parent | 45c5c71f9e8f0ae9155be947b7548ed211e1fa4b (diff) |
Fixed follow / unfollow mess for shared inboxes.
-rw-r--r-- | activitypub.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index ff568c8..cfe3eea 100644 --- a/activitypub.c +++ b/activitypub.c @@ -468,9 +468,9 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) return following_check(snac, actor); } - /* if it's an Undo + Follow, it must be from someone we follow */ + /* if it's an Undo + Follow, it must be from someone that follows us */ if (xs_match(type, "Undo")) { - return following_check(snac, actor); + return follower_check(snac, actor); } /* if it's an Accept + Follow, it must be for a Follow we created */ @@ -478,6 +478,12 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) return following_check(snac, actor); } + /* if it's a Follow, it must be explicitly for us */ + if (xs_match(type, "Follow")) { + char *object = xs_dict_get(c_msg, "object"); + return !xs_is_null(object) && strcmp(snac->actor, object) == 0; + } + /* if it's not a Create or Update, allow as is */ if (!xs_match(type, "Create|Update")) { return 1; |