summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c
index b505fbb..86599ee 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -636,19 +636,32 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
636 if (xs_match(type, "Like|Announce|EmojiReact")) { 636 if (xs_match(type, "Like|Announce|EmojiReact")) {
637 const char *object = xs_dict_get(c_msg, "object"); 637 const char *object = xs_dict_get(c_msg, "object");
638 638
639 if (xs_type(object) == XSTYPE_DICT) 639 if (xs_is_dict(object))
640 object = xs_dict_get(object, "id"); 640 object = xs_dict_get(object, "id");
641 641
642 /* bad object id? reject */ 642 /* bad object id? reject */
643 if (xs_type(object) != XSTYPE_STRING) 643 if (!xs_is_string(object))
644 return 0; 644 return 0;
645 645
646 /* if it's about one of our posts, accept it */ 646 /* if it's about one of our posts, accept it */
647 if (xs_startswith(object, snac->actor)) 647 if (xs_startswith(object, snac->actor))
648 return 2; 648 return 2;
649 649
650 /* if it's by someone we don't follow, reject */ 650 /* if it's by someone we follow, accept it */
651 return following_check(snac, actor); 651 if (following_check(snac, actor))
652 return 1;
653
654 /* do we follow any hashtag? */
655 if (xs_is_list(xs_dict_get(snac->config, "followed_hashtags"))) {
656 xs *obj = NULL;
657
658 /* if the admired object contains any followed hashtag, accept it */
659 if (valid_status(object_get(object, &obj)) &&
660 followed_hashtag_check(snac, obj))
661 return 7;
662 }
663
664 return 0;
652 } 665 }
653 666
654 /* if it's an Undo, it must be from someone related to us */ 667 /* if it's an Undo, it must be from someone related to us */