summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-23 08:51:02 +0200
committerdefault <nobody@localhost>2023-04-23 08:51:02 +0200
commit4fca7c8a7ea2ee1373827c1e4d3726c8e763e2cc (patch)
tree682a006056d815b4cb3fe427ababfaf96b45150a /mastoapi.c
parent291f251cedc9277d6cacc0071c9d4c03cd0bf32b (diff)
Added mastoapi unfollow.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 894996d..ce1e547 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1644,6 +1644,22 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
}
else
if (strcmp(opt, "unfollow") == 0) {
+ if (valid_status(object_get_by_md5(md5, &actor_o))) {
+ const char *actor = xs_dict_get(actor_o, "id");
+
+ /* get the following object */
+ xs *object = NULL;
+
+ if (valid_status(following_get(&snac, actor, &object))) {
+ xs *msg = msg_undo(&snac, xs_dict_get(object, "object"));
+
+ following_del(&snac, actor);
+
+ enqueue_output_by_actor(&snac, msg, actor, 0);
+
+ rsp = mastoapi_relationship(&snac, md5);
+ }
+ }
}
}