summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-05 23:23:19 +0200
committerdefault <nobody@localhost>2023-04-05 23:23:19 +0200
commit5d26f31a8abc3083a22390f6bac99861a5bca77e (patch)
tree5eca7799bc509daef48aade0aa9a049f124c443e
parent1cdd6d19960c2e448de43eec85f4c4f87776459f (diff)
Fixed overzealous rejection of Announces.
-rw-r--r--activitypub.c11
-rw-r--r--snac.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index b21120f..0caf970 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -299,8 +299,17 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg)
{
const char *type = xs_dict_get(c_msg, "type");
- /* if it's an Announce by someone we don't follow, reject */
if (strcmp(type, "Announce") == 0) {
+ const char *object = xs_dict_get(c_msg, "object");
+
+ if (xs_type(object) == XSTYPE_DICT)
+ object = xs_dict_get(object, "id");
+
+ /* 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 */
if (!following_check(snac, xs_dict_get(c_msg, "actor")))
return 0;
}
diff --git a/snac.h b/snac.h
index 9740b0a..3096904 100644
--- a/snac.h
+++ b/snac.h
@@ -1,7 +1,7 @@
/* snac - A simple, minimalistic ActivityPub instance */
/* copyright (c) 2022 - 2023 grunfink / MIT license */
-#define VERSION "2.26"
+#define VERSION "2.27-dev"
#define USER_AGENT "snac/" VERSION