msg_update() sends copies the 'to' and 'cc' fields in notes.

This commit is contained in:
default 2023-03-06 11:26:43 +01:00
parent 751211684f
commit 60f77b6cad
2 changed files with 10 additions and 3 deletions

View file

@ -445,11 +445,18 @@ d_char *msg_accept(snac *snac, char *object, char *to)
}
d_char *msg_update(snac *snac, char *object)
xs_dict *msg_update(snac *snac, xs_dict *object)
/* creates an Update message */
{
d_char *msg = msg_base(snac, "Update", "@object", snac->actor, "@now", object);
char *type = xs_dict_get(object, "type");
if (strcmp(type, "Note") == 0) {
msg = xs_dict_append(msg, "to", xs_dict_get(object, "to"));
msg = xs_dict_append(msg, "cc", xs_dict_get(object, "cc"));
}
else
msg = xs_dict_append(msg, "to", public_address);
return msg;

2
snac.h
View file

@ -183,7 +183,7 @@ xs_dict *msg_note(snac *snac, xs_str *content, xs_val *rcpts,
d_char *msg_undo(snac *snac, char *object);
d_char *msg_delete(snac *snac, char *id);
d_char *msg_actor(snac *snac);
d_char *msg_update(snac *snac, char *object);
xs_dict *msg_update(snac *snac, xs_dict *object);
int activitypub_request(snac *snac, char *url, d_char **data);
int actor_request(snac *snac, char *actor, d_char **data);