diff options
| author | 2023-12-18 11:37:02 +0100 | |
|---|---|---|
| committer | 2023-12-18 11:37:02 +0100 | |
| commit | 52f27123bbd6cf8101a86618c6aa04f52a07543a (patch) | |
| tree | 693ebd30feb613f0829c13bf2ae53bfe6c46ba2b /activitypub.c | |
| parent | Fixed Accept + Follow for shared inboxes. (diff) | |
| download | snac2-52f27123bbd6cf8101a86618c6aa04f52a07543a.tar.gz snac2-52f27123bbd6cf8101a86618c6aa04f52a07543a.tar.xz snac2-52f27123bbd6cf8101a86618c6aa04f52a07543a.zip | |
Fixed follow / unfollow mess for shared inboxes.
Diffstat (limited to 'activitypub.c')
| -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) | |||
| 468 | return following_check(snac, actor); | 468 | return following_check(snac, actor); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | /* if it's an Undo + Follow, it must be from someone we follow */ | 471 | /* if it's an Undo + Follow, it must be from someone that follows us */ |
| 472 | if (xs_match(type, "Undo")) { | 472 | if (xs_match(type, "Undo")) { |
| 473 | return following_check(snac, actor); | 473 | return follower_check(snac, actor); |
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | /* if it's an Accept + Follow, it must be for a Follow we created */ | 476 | /* 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) | |||
| 478 | return following_check(snac, actor); | 478 | return following_check(snac, actor); |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | /* if it's a Follow, it must be explicitly for us */ | ||
| 482 | if (xs_match(type, "Follow")) { | ||
| 483 | char *object = xs_dict_get(c_msg, "object"); | ||
| 484 | return !xs_is_null(object) && strcmp(snac->actor, object) == 0; | ||
| 485 | } | ||
| 486 | |||
| 481 | /* if it's not a Create or Update, allow as is */ | 487 | /* if it's not a Create or Update, allow as is */ |
| 482 | if (!xs_match(type, "Create|Update")) { | 488 | if (!xs_match(type, "Create|Update")) { |
| 483 | return 1; | 489 | return 1; |