diff options
| author | 2025-07-27 16:02:01 +0200 | |
|---|---|---|
| committer | 2025-07-27 16:02:01 +0200 | |
| commit | 971fc024f25080238a3625c646ce3601318d9f0a (patch) | |
| tree | 85e4190a8a7cb0e5e9b0d15a329b641c152a7f08 | |
| parent | Fixed bug in new delete targets. (diff) | |
| download | snac2-971fc024f25080238a3625c646ce3601318d9f0a.tar.gz snac2-971fc024f25080238a3625c646ce3601318d9f0a.tar.xz snac2-971fc024f25080238a3625c646ce3601318d9f0a.zip | |
Also add children to msg_delete().
| -rw-r--r-- | activitypub.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/activitypub.c b/activitypub.c index 968450b..634e243 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1519,21 +1519,28 @@ xs_dict *msg_delete(snac *snac, const char *id) | |||
| 1519 | msg = msg_base(snac, "Delete", "@object", snac->actor, "@now", tomb); | 1519 | msg = msg_base(snac, "Delete", "@object", snac->actor, "@now", tomb); |
| 1520 | 1520 | ||
| 1521 | xs *to = xs_list_new(); | 1521 | xs *to = xs_list_new(); |
| 1522 | xs *admirers = object_likes(id); | 1522 | xs *involved = object_likes(id); |
| 1523 | xs *boosts = object_announces(id); | 1523 | xs *boosts = object_announces(id); |
| 1524 | admirers = xs_list_cat(admirers, boosts); | 1524 | xs *children = object_children(id); |
| 1525 | const char *md5; | 1525 | const char *md5; |
| 1526 | 1526 | ||
| 1527 | involved = xs_list_cat(involved, boosts); | ||
| 1528 | involved = xs_list_cat(involved, children); | ||
| 1529 | |||
| 1527 | /* add everybody */ | 1530 | /* add everybody */ |
| 1528 | to = xs_list_append(to, public_address); | 1531 | to = xs_list_append(to, public_address); |
| 1529 | 1532 | ||
| 1530 | /* add actors that liked or boosted this */ | 1533 | /* add actors that liked, boosted or replied to this */ |
| 1531 | xs_list_foreach(admirers, md5) { | 1534 | xs_list_foreach(involved, md5) { |
| 1532 | xs *actor = NULL; | 1535 | xs *actor = NULL; |
| 1533 | 1536 | ||
| 1534 | if (valid_status(object_get_by_md5(md5, &actor))) { | 1537 | if (valid_status(object_get_by_md5(md5, &actor))) { |
| 1535 | const char *id = xs_dict_get(actor, "id"); | 1538 | const char *id = xs_dict_get(actor, "id"); |
| 1539 | const char *atto = get_atto(actor); | ||
| 1536 | 1540 | ||
| 1541 | if (xs_is_string(atto)) | ||
| 1542 | to = xs_list_append(to, atto); | ||
| 1543 | else | ||
| 1537 | if (xs_is_string(id)) | 1544 | if (xs_is_string(id)) |
| 1538 | to = xs_list_append(to, id); | 1545 | to = xs_list_append(to, id); |
| 1539 | } | 1546 | } |
| @@ -1541,9 +1548,6 @@ xs_dict *msg_delete(snac *snac, const char *id) | |||
| 1541 | 1548 | ||
| 1542 | msg = xs_dict_append(msg, "to", to); | 1549 | msg = xs_dict_append(msg, "to", to); |
| 1543 | 1550 | ||
| 1544 | xs_json_dump(msg, 4, stdout); | ||
| 1545 | printf("\n"); | ||
| 1546 | |||
| 1547 | return msg; | 1551 | return msg; |
| 1548 | } | 1552 | } |
| 1549 | 1553 | ||