summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-04-10 18:27:17 +0200
committerdefault <nobody@localhost>2024-04-10 18:27:17 +0200
commit1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6 (patch)
treea279608df3544efc8fcf79af5c11b8bb51e609b7 /activitypub.c
parenta6958d6161b09110c2d88ee6d96cadcc1c458b27 (diff)
New function msg_repulsion.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c
index c88b0ce..afbe7af 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1168,6 +1168,33 @@ xs_dict *msg_admiration(snac *snac, char *object, char *type)
}
+xs_dict *msg_repulsion(snac *user, char *id, char *type)
+/* creates an Undo + admiration message */
+{
+ xs *a_msg = NULL;
+ xs_dict *msg = NULL;
+
+ if (valid_status(object_get(id, &a_msg))) {
+ /* create a clone of the original admiration message */
+ xs *object = msg_admiration(user, id, type);
+
+ /* delete the published date */
+ object = xs_dict_del(object, "published");
+
+ /* create an undo message for this object */
+ msg = msg_undo(user, object);
+
+ /* copy the 'to' field */
+ msg = xs_dict_set(msg, "to", xs_dict_get(object, "to"));
+
+ /* now we despise this */
+ object_unadmire(id, user->actor, *type == 'L' ? 1 : 0);
+ }
+
+ return msg;
+}
+
+
xs_dict *msg_actor(snac *snac)
/* create a Person message for this actor */
{