summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-01 19:37:47 +0200
committerdefault <nobody@localhost>2022-10-01 19:37:47 +0200
commit82e9a03925d27d9228ac5a20445b02902a70d0ca (patch)
tree61fc680d00bfbfa02fdc77d7a85030187187323f /activitypub.c
parent450c0e7aad09491b2abd177e695d3080c352af5e (diff)
Implemented 'Delete'.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c
index 99fe498..21316c0 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -163,12 +163,16 @@ d_char *recipient_list(snac *snac, char *msg, int expand_public)
for (n = 0; lists[n]; n++) {
char *l = lists[n];
char *v;
+ xs *tl = NULL;
+ /* if it's a string, create a list with only one element */
if (xs_type(l) == XSTYPE_STRING) {
- if (xs_list_in(list, l) == -1)
- list = xs_list_append(list, l);
+ tl = xs_list_new();
+ tl = xs_list_append(tl, l);
+
+ l = tl;
}
- else
+
while (xs_list_iter(&l, &v)) {
if (expand_public && strcmp(v, public_address) == 0) {
/* iterate the followers and add them */
@@ -455,6 +459,25 @@ d_char *msg_undo(snac *snac, char *object)
}
+d_char *msg_delete(snac *snac, char *id)
+/* creates a 'Delete' + 'Tombstone' for a local entry */
+{
+ xs *tomb = xs_dict_new();
+ d_char *msg = NULL;
+
+ /* sculpt the tombstone */
+ tomb = xs_dict_append(tomb, "type", "Tombstone");
+ tomb = xs_dict_append(tomb, "id", id);
+
+ /* now create the Delete */
+ msg = msg_base(snac, "Delete", "@object", snac->actor, "@now", tomb);
+
+ msg = xs_dict_append(msg, "to", public_address);
+
+ return msg;
+}
+
+
d_char *msg_follow(snac *snac, char *actor)
/* creates a 'Follow' message */
{