summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-12-17 16:25:04 +0100
committerGravatar default2023-12-17 16:25:04 +0100
commit29b6b5c717add09a55266fe04ddaea62c414b68e (patch)
tree83cd9289c8d323189a0291fb980d5944a3756ee7
parentMore is_msg_for_me() tweaks. (diff)
downloadsnac2-29b6b5c717add09a55266fe04ddaea62c414b68e.tar.gz
snac2-29b6b5c717add09a55266fe04ddaea62c414b68e.tar.xz
snac2-29b6b5c717add09a55266fe04ddaea62c414b68e.zip
Even more is_msg_for_me() updates.
-rw-r--r--activitypub.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c
index f948edc..07d0c17 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -447,7 +447,8 @@ int is_msg_public(const xs_dict *msg)
447int is_msg_for_me(snac *snac, const xs_dict *c_msg) 447int is_msg_for_me(snac *snac, const xs_dict *c_msg)
448/* checks if this message is for me */ 448/* checks if this message is for me */
449{ 449{
450 const char *type = xs_dict_get(c_msg, "type"); 450 const char *type = xs_dict_get(c_msg, "type");
451 const char *actor = xs_dict_get(c_msg, "actor");
451 452
452 if (xs_match(type, "Like|Announce")) { 453 if (xs_match(type, "Like|Announce")) {
453 const char *object = xs_dict_get(c_msg, "object"); 454 const char *object = xs_dict_get(c_msg, "object");
@@ -464,12 +465,12 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
464 return 2; 465 return 2;
465 466
466 /* if it's by someone we don't follow, reject */ 467 /* if it's by someone we don't follow, reject */
467 return following_check(snac, xs_dict_get(c_msg, "actor")); 468 return following_check(snac, actor);
468 } 469 }
469 470
470 /* if it's an Undo or an Update, it must be from someone we follow */ 471 /* if it's an Undo or an Update, it must be from someone we follow */
471 if (xs_match(type, "Undo|Update")) { 472 if (xs_match(type, "Undo|Update")) {
472 return following_check(snac, xs_dict_get(c_msg, "actor")); 473 return following_check(snac, actor);
473 } 474 }
474 475
475 /* if it's not a Create, allow as is */ 476 /* if it's not a Create, allow as is */
@@ -477,6 +478,10 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
477 return 1; 478 return 1;
478 } 479 }
479 480
481 /* if we follow the Creator of this post, allow */
482 if (following_check(snac, actor))
483 return 1;
484
480 xs_dict *msg = xs_dict_get(c_msg, "object"); 485 xs_dict *msg = xs_dict_get(c_msg, "object");
481 xs *rcpts = recipient_list(snac, msg, 0); 486 xs *rcpts = recipient_list(snac, msg, 0);
482 xs_list *p = rcpts; 487 xs_list *p = rcpts;