summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c
index 104110d..2813beb 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -587,12 +587,10 @@ int is_msg_from_private_user(const xs_dict *msg)
587} 587}
588 588
589 589
590int followed_hashtag_check(snac *user, const xs_dict *msg) 590int hashtag_in_msg(const xs_list *hashtags, const xs_dict *msg)
591/* returns true if this message contains a hashtag followed by me */ 591/* returns 1 if the message contains any of the list of hashtags */
592{ 592{
593 const xs_list *fw_tags = xs_dict_get(user->config, "followed_hashtags"); 593 if (xs_is_list(hashtags)) {
594
595 if (xs_is_list(fw_tags)) {
596 const xs_list *tags_in_msg = xs_dict_get(msg, "tag"); 594 const xs_list *tags_in_msg = xs_dict_get(msg, "tag");
597 595
598 if (xs_is_list(tags_in_msg)) { 596 if (xs_is_list(tags_in_msg)) {
@@ -608,7 +606,7 @@ int followed_hashtag_check(snac *user, const xs_dict *msg)
608 if (strcmp(type, "Hashtag") == 0) { 606 if (strcmp(type, "Hashtag") == 0) {
609 xs *lc_name = xs_utf8_to_lower(name); 607 xs *lc_name = xs_utf8_to_lower(name);
610 608
611 if (xs_list_in(fw_tags, lc_name) != -1) 609 if (xs_list_in(hashtags, lc_name) != -1)
612 return 1; 610 return 1;
613 } 611 }
614 } 612 }
@@ -621,6 +619,13 @@ int followed_hashtag_check(snac *user, const xs_dict *msg)
621} 619}
622 620
623 621
622int followed_hashtag_check(snac *user, const xs_dict *msg)
623/* returns true if this message contains a hashtag followed by me */
624{
625 return hashtag_in_msg(xs_dict_get(user->config, "followed_hashtags"), msg);
626}
627
628
624void followed_hashtag_distribute(const xs_dict *msg) 629void followed_hashtag_distribute(const xs_dict *msg)
625/* distribute this post to all users following the included hashtags */ 630/* distribute this post to all users following the included hashtags */
626{ 631{