diff options
| author | 2023-04-23 08:51:02 +0200 | |
|---|---|---|
| committer | 2023-04-23 08:51:02 +0200 | |
| commit | 4fca7c8a7ea2ee1373827c1e4d3726c8e763e2cc (patch) | |
| tree | 682a006056d815b4cb3fe427ababfaf96b45150a /mastoapi.c | |
| parent | Added mastoapi follow. (diff) | |
| download | snac2-4fca7c8a7ea2ee1373827c1e4d3726c8e763e2cc.tar.gz snac2-4fca7c8a7ea2ee1373827c1e4d3726c8e763e2cc.tar.xz snac2-4fca7c8a7ea2ee1373827c1e4d3726c8e763e2cc.zip | |
Added mastoapi unfollow.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -1644,6 +1644,22 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1644 | } | 1644 | } |
| 1645 | else | 1645 | else |
| 1646 | if (strcmp(opt, "unfollow") == 0) { | 1646 | if (strcmp(opt, "unfollow") == 0) { |
| 1647 | if (valid_status(object_get_by_md5(md5, &actor_o))) { | ||
| 1648 | const char *actor = xs_dict_get(actor_o, "id"); | ||
| 1649 | |||
| 1650 | /* get the following object */ | ||
| 1651 | xs *object = NULL; | ||
| 1652 | |||
| 1653 | if (valid_status(following_get(&snac, actor, &object))) { | ||
| 1654 | xs *msg = msg_undo(&snac, xs_dict_get(object, "object")); | ||
| 1655 | |||
| 1656 | following_del(&snac, actor); | ||
| 1657 | |||
| 1658 | enqueue_output_by_actor(&snac, msg, actor, 0); | ||
| 1659 | |||
| 1660 | rsp = mastoapi_relationship(&snac, md5); | ||
| 1661 | } | ||
| 1662 | } | ||
| 1647 | } | 1663 | } |
| 1648 | } | 1664 | } |
| 1649 | 1665 | ||