summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-07-29 15:19:52 +0200
committerdefault <nobody@localhost>2023-07-29 15:19:52 +0200
commit751eb0586adbb3e4a0469e0dca2ed4d623a6c338 (patch)
tree8d90a92108100224d6e1d3e44b846c9e05a4488b
parent0f8c0cd6943992e44a1454ed6c8bdeef0faee722 (diff)
msg_create() is of type @wrapper.
This means that it also generate the same id for the same Note.
-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,
else
id = NULL;
}
+ else
+ if (strcmp(id, "@wrapper") == 0) {
+ /* like @object, but always generate the same id */
+ if (object != NULL) {
+ did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type);
+ id = did;
+ }
+ else
+ id = NULL;
+ }
}
xs_dict *msg = xs_dict_new();
@@ -935,7 +945,7 @@ xs_dict *msg_actor(snac *snac)
xs_dict *msg_create(snac *snac, const xs_dict *object)
/* creates a 'Create' message */
{
- xs_dict *msg = msg_base(snac, "Create", "@object", snac->actor, "@now", object);
+ xs_dict *msg = msg_base(snac, "Create", "@wrapper", snac->actor, "@now", object);
xs_val *v;
if ((v = xs_dict_get(object, "attributedTo")))