diff options
| author | 2024-04-10 18:27:17 +0200 | |
|---|---|---|
| committer | 2024-04-10 18:27:17 +0200 | |
| commit | 1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6 (patch) | |
| tree | a279608df3544efc8fcf79af5c11b8bb51e609b7 /activitypub.c | |
| parent | Added cmdline 'boost' as an alias to 'announce'. (diff) | |
| download | snac2-1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6.tar.gz snac2-1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6.tar.xz snac2-1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6.zip | |
New function msg_repulsion.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 27 |
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) | |||
| 1168 | } | 1168 | } |
| 1169 | 1169 | ||
| 1170 | 1170 | ||
| 1171 | xs_dict *msg_repulsion(snac *user, char *id, char *type) | ||
| 1172 | /* creates an Undo + admiration message */ | ||
| 1173 | { | ||
| 1174 | xs *a_msg = NULL; | ||
| 1175 | xs_dict *msg = NULL; | ||
| 1176 | |||
| 1177 | if (valid_status(object_get(id, &a_msg))) { | ||
| 1178 | /* create a clone of the original admiration message */ | ||
| 1179 | xs *object = msg_admiration(user, id, type); | ||
| 1180 | |||
| 1181 | /* delete the published date */ | ||
| 1182 | object = xs_dict_del(object, "published"); | ||
| 1183 | |||
| 1184 | /* create an undo message for this object */ | ||
| 1185 | msg = msg_undo(user, object); | ||
| 1186 | |||
| 1187 | /* copy the 'to' field */ | ||
| 1188 | msg = xs_dict_set(msg, "to", xs_dict_get(object, "to")); | ||
| 1189 | |||
| 1190 | /* now we despise this */ | ||
| 1191 | object_unadmire(id, user->actor, *type == 'L' ? 1 : 0); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | return msg; | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | |||
| 1171 | xs_dict *msg_actor(snac *snac) | 1198 | xs_dict *msg_actor(snac *snac) |
| 1172 | /* create a Person message for this actor */ | 1199 | /* create a Person message for this actor */ |
| 1173 | { | 1200 | { |