diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 11 |
1 files changed, 10 insertions, 1 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) | |||
| 299 | { | 299 | { |
| 300 | const char *type = xs_dict_get(c_msg, "type"); | 300 | const char *type = xs_dict_get(c_msg, "type"); |
| 301 | 301 | ||
| 302 | /* if it's an Announce by someone we don't follow, reject */ | ||
| 303 | if (strcmp(type, "Announce") == 0) { | 302 | if (strcmp(type, "Announce") == 0) { |
| 303 | const char *object = xs_dict_get(c_msg, "object"); | ||
| 304 | |||
| 305 | if (xs_type(object) == XSTYPE_DICT) | ||
| 306 | object = xs_dict_get(object, "id"); | ||
| 307 | |||
| 308 | /* if it's about one of our posts, accept it */ | ||
| 309 | if (xs_startswith(object, snac->actor)) | ||
| 310 | return 2; | ||
| 311 | |||
| 312 | /* if it's by someone we don't follow, reject */ | ||
| 304 | if (!following_check(snac, xs_dict_get(c_msg, "actor"))) | 313 | if (!following_check(snac, xs_dict_get(c_msg, "actor"))) |
| 305 | return 0; | 314 | return 0; |
| 306 | } | 315 | } |