diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 16 |
1 files changed, 15 insertions, 1 deletions
| @@ -867,7 +867,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 867 | } | 867 | } |
| 868 | else | 868 | else |
| 869 | if (strcmp(action, L("Follow")) == 0) { | 869 | if (strcmp(action, L("Follow")) == 0) { |
| 870 | char *msg = msg_follow(&snac, actor); | 870 | xs *msg = msg_follow(&snac, actor); |
| 871 | 871 | ||
| 872 | /* reload the actor from the message, in may be different */ | 872 | /* reload the actor from the message, in may be different */ |
| 873 | actor = xs_dict_get(msg, "object"); | 873 | actor = xs_dict_get(msg, "object"); |
| @@ -878,6 +878,20 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 878 | } | 878 | } |
| 879 | else | 879 | else |
| 880 | if (strcmp(action, L("Unfollow")) == 0) { | 880 | if (strcmp(action, L("Unfollow")) == 0) { |
| 881 | /* get the following object */ | ||
| 882 | xs *object = NULL; | ||
| 883 | |||
| 884 | if (valid_status(following_get(&snac, actor, &object))) { | ||
| 885 | xs *msg = msg_undo(&snac, xs_dict_get(object, "object")); | ||
| 886 | |||
| 887 | following_del(&snac, actor); | ||
| 888 | |||
| 889 | enqueue_output(&snac, msg, actor, 0); | ||
| 890 | |||
| 891 | snac_log(&snac, xs_fmt("unfollowed actor %s", actor)); | ||
| 892 | } | ||
| 893 | else | ||
| 894 | snac_log(&snac, xs_fmt("actor is not being followed %s", actor)); | ||
| 881 | } | 895 | } |
| 882 | else | 896 | else |
| 883 | if (strcmp(action, L("Delete")) == 0) { | 897 | if (strcmp(action, L("Delete")) == 0) { |