diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 100db67..634e243 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1518,7 +1518,35 @@ xs_dict *msg_delete(snac *snac, const char *id) /* now create the Delete */ msg = msg_base(snac, "Delete", "@object", snac->actor, "@now", tomb); - msg = xs_dict_append(msg, "to", public_address); + xs *to = xs_list_new(); + xs *involved = object_likes(id); + xs *boosts = object_announces(id); + xs *children = object_children(id); + const char *md5; + + involved = xs_list_cat(involved, boosts); + involved = xs_list_cat(involved, children); + + /* add everybody */ + to = xs_list_append(to, public_address); + + /* add actors that liked, boosted or replied to this */ + xs_list_foreach(involved, md5) { + xs *actor = NULL; + + if (valid_status(object_get_by_md5(md5, &actor))) { + const char *id = xs_dict_get(actor, "id"); + const char *atto = get_atto(actor); + + if (xs_is_string(atto)) + to = xs_list_append(to, atto); + else + if (xs_is_string(id)) + to = xs_list_append(to, id); + } + } + + msg = xs_dict_append(msg, "to", to); return msg; } |