aboutsummaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-22 10:38:01 +0100
committerdefault <nobody@localhost>2025-01-22 10:38:01 +0100
commita51c996efe0e41334523602271740b6e6b2501c0 (patch)
tree6fa46e86218116c994e2fc01e1b33aa7cf369679 /activitypub.c
parentac663a6b4dd5eee1fb3c676524b8e141eb2529ed (diff)
More tweaks to hashtag following code.
Diffstat (limited to 'activitypub.c')
-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)
if (xs_match(type, "Like|Announce|EmojiReact")) {
const char *object = xs_dict_get(c_msg, "object");
- if (xs_type(object) == XSTYPE_DICT)
+ if (xs_is_dict(object))
object = xs_dict_get(object, "id");
/* bad object id? reject */
- if (xs_type(object) != XSTYPE_STRING)
+ if (!xs_is_string(object))
return 0;
/* if it's about one of our posts, accept it */
if (xs_startswith(object, snac->actor))
return 2;
- /* if it's by someone we don't follow, reject */
- return following_check(snac, actor);
+ /* if it's by someone we follow, accept it */
+ if (following_check(snac, actor))
+ return 1;
+
+ /* do we follow any hashtag? */
+ if (xs_is_list(xs_dict_get(snac->config, "followed_hashtags"))) {
+ xs *obj = NULL;
+
+ /* if the admired object contains any followed hashtag, accept it */
+ if (valid_status(object_get(object, &obj)) &&
+ followed_hashtag_check(snac, obj))
+ return 7;
+ }
+
+ return 0;
}
/* if it's an Undo, it must be from someone related to us */