summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2023-07-29 15:19:52 +0200
committerGravatar default2023-07-29 15:19:52 +0200
commit751eb0586adbb3e4a0469e0dca2ed4d623a6c338 (patch)
tree8d90a92108100224d6e1d3e44b846c9e05a4488b /activitypub.c
parentUpdated comment in headers. (diff)
downloadsnac2-751eb0586adbb3e4a0469e0dca2ed4d623a6c338.tar.gz
snac2-751eb0586adbb3e4a0469e0dca2ed4d623a6c338.tar.xz
snac2-751eb0586adbb3e4a0469e0dca2ed4d623a6c338.zip
msg_create() is of type @wrapper.
This means that it also generate the same id for the same Note.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index 26a8347..05eb32f 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -764,6 +764,16 @@ xs_dict *msg_base(snac *snac, const char *type, const char *id,
764 else 764 else
765 id = NULL; 765 id = NULL;
766 } 766 }
767 else
768 if (strcmp(id, "@wrapper") == 0) {
769 /* like @object, but always generate the same id */
770 if (object != NULL) {
771 did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type);
772 id = did;
773 }
774 else
775 id = NULL;
776 }
767 } 777 }
768 778
769 xs_dict *msg = xs_dict_new(); 779 xs_dict *msg = xs_dict_new();
@@ -935,7 +945,7 @@ xs_dict *msg_actor(snac *snac)
935xs_dict *msg_create(snac *snac, const xs_dict *object) 945xs_dict *msg_create(snac *snac, const xs_dict *object)
936/* creates a 'Create' message */ 946/* creates a 'Create' message */
937{ 947{
938 xs_dict *msg = msg_base(snac, "Create", "@object", snac->actor, "@now", object); 948 xs_dict *msg = msg_base(snac, "Create", "@wrapper", snac->actor, "@now", object);
939 xs_val *v; 949 xs_val *v;
940 950
941 if ((v = xs_dict_get(object, "attributedTo"))) 951 if ((v = xs_dict_get(object, "attributedTo")))