summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c28
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)
489 xs_list *p = rcpts; 489 xs_list *p = rcpts;
490 xs_str *v; 490 xs_str *v;
491 491
492 xs *actor_followers = NULL;
493
494 if (!pub_msg) {
495 /* not a public message; get the actor and its followers list */
496 xs *actor_obj = NULL;
497
498 if (valid_status(object_get(actor, &actor_obj))) {
499 if ((v = xs_dict_get(actor_obj, "followers")))
500 actor_followers = xs_dup(v);
501 }
502 }
503
492 while(xs_list_iter(&p, &v)) { 504 while(xs_list_iter(&p, &v)) {
493 /* explicitly for me? accept */ 505 /* explicitly for me? accept */
494 if (strcmp(v, snac->actor) == 0) 506 if (strcmp(v, snac->actor) == 0)
495 return 2; 507 return 2;
496 508
497 /* for someone we follow? (probably cc'ed) accept */ 509 if (pub_msg) {
498 if (pub_msg && following_check(snac, v)) 510 /* a public message for someone we follow? (probably cc'ed) accept */
499 return 5; 511 if (following_check(snac, v))
512 return 5;
513 }
514 else
515 if (actor_followers && strcmp(v, actor_followers) == 0) {
516 /* if this message is for this actor's followers, are we one of them? */
517 if (following_check(snac, actor)) {
518 snac_debug(snac, 0, xs_fmt("---> non-public msg for followers"));
519 return 6;
520 }
521 }
500 } 522 }
501 523
502 /* accept if it's by someone we follow */ 524 /* accept if it's by someone we follow */