diff options
| author | 2022-09-28 05:16:17 +0200 | |
|---|---|---|
| committer | 2022-09-28 05:16:17 +0200 | |
| commit | 3b8a43013d2e602135d73070dd3922b77bdfaefa (patch) | |
| tree | d5b2913452129ac08a90e100ab80bf1f1bc1a446 /activitypub.c | |
| parent | Delete the _snac field in outbox. (diff) | |
| download | snac2-3b8a43013d2e602135d73070dd3922b77bdfaefa.tar.gz snac2-3b8a43013d2e602135d73070dd3922b77bdfaefa.tar.xz snac2-3b8a43013d2e602135d73070dd3922b77bdfaefa.zip | |
Check for muted actors in Announce messages.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index 2020caf..fc90fe6 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -563,6 +563,7 @@ void process_message(snac *snac, char *msg, char *req) | |||
| 563 | /* actor and type exist, were checked previously */ | 563 | /* actor and type exist, were checked previously */ |
| 564 | char *actor = xs_dict_get(msg, "actor"); | 564 | char *actor = xs_dict_get(msg, "actor"); |
| 565 | char *type = xs_dict_get(msg, "type"); | 565 | char *type = xs_dict_get(msg, "type"); |
| 566 | xs *actor_o = NULL; | ||
| 566 | 567 | ||
| 567 | char *object, *utype; | 568 | char *object, *utype; |
| 568 | 569 | ||
| @@ -572,6 +573,9 @@ void process_message(snac *snac, char *msg, char *req) | |||
| 572 | else | 573 | else |
| 573 | utype = "(null)"; | 574 | utype = "(null)"; |
| 574 | 575 | ||
| 576 | /* bring the actor */ | ||
| 577 | actor_request(snac, actor, &actor_o); | ||
| 578 | |||
| 575 | /* check the signature */ | 579 | /* check the signature */ |
| 576 | /* ... */ | 580 | /* ... */ |
| 577 | 581 | ||
| @@ -632,13 +636,25 @@ void process_message(snac *snac, char *msg, char *req) | |||
| 632 | } | 636 | } |
| 633 | else | 637 | else |
| 634 | if (strcmp(type, "Announce") == 0) { | 638 | if (strcmp(type, "Announce") == 0) { |
| 639 | xs *a_msg = NULL; | ||
| 640 | |||
| 635 | if (xs_type(object) == XSTYPE_DICT) | 641 | if (xs_type(object) == XSTYPE_DICT) |
| 636 | object = xs_dict_get(object, "id"); | 642 | object = xs_dict_get(object, "id"); |
| 637 | 643 | ||
| 638 | timeline_request(snac, object, actor); | 644 | timeline_request(snac, object, actor); |
| 639 | 645 | ||
| 640 | timeline_admire(snac, object, actor, 0); | 646 | if ((a_msg = timeline_find(snac, object)) != NULL) { |
| 641 | snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); | 647 | char *who = xs_dict_get(a_msg, "attributedTo"); |
| 648 | |||
| 649 | if (who && !is_muted(snac, who)) { | ||
| 650 | timeline_admire(snac, object, actor, 0); | ||
| 651 | snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); | ||
| 652 | } | ||
| 653 | else | ||
| 654 | snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who)); | ||
| 655 | } | ||
| 656 | else | ||
| 657 | snac_log(snac, xs_fmt("error requesting 'Announce' object %s", object)); | ||
| 642 | } | 658 | } |
| 643 | /* | 659 | /* |
| 644 | else | 660 | else |