diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 31 |
1 files changed, 31 insertions, 0 deletions
| @@ -2282,6 +2282,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2282 | char *id = xs_dict_get(p_vars, "id"); | 2282 | char *id = xs_dict_get(p_vars, "id"); |
| 2283 | char *actor = xs_dict_get(p_vars, "actor"); | 2283 | char *actor = xs_dict_get(p_vars, "actor"); |
| 2284 | char *action = xs_dict_get(p_vars, "action"); | 2284 | char *action = xs_dict_get(p_vars, "action"); |
| 2285 | char *group = xs_dict_get(p_vars, "group"); | ||
| 2285 | 2286 | ||
| 2286 | if (action == NULL) | 2287 | if (action == NULL) |
| 2287 | return 404; | 2288 | return 404; |
| @@ -2358,6 +2359,36 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2358 | snac_log(&snac, xs_fmt("actor is not being followed %s", actor)); | 2359 | snac_log(&snac, xs_fmt("actor is not being followed %s", actor)); |
| 2359 | } | 2360 | } |
| 2360 | else | 2361 | else |
| 2362 | if (strcmp(action, L("Follow Group")) == 0) { /** **/ | ||
| 2363 | xs *msg = msg_follow(&snac, group); | ||
| 2364 | |||
| 2365 | if (msg != NULL) { | ||
| 2366 | /* reload the group from the message, in may be different */ | ||
| 2367 | group = xs_dict_get(msg, "object"); | ||
| 2368 | |||
| 2369 | following_add(&snac, group, msg); | ||
| 2370 | |||
| 2371 | enqueue_output_by_actor(&snac, msg, group, 0); | ||
| 2372 | } | ||
| 2373 | } | ||
| 2374 | else | ||
| 2375 | if (strcmp(action, L("Unfollow Group")) == 0) { /** **/ | ||
| 2376 | /* get the following object */ | ||
| 2377 | xs *object = NULL; | ||
| 2378 | |||
| 2379 | if (valid_status(following_get(&snac, group, &object))) { | ||
| 2380 | xs *msg = msg_undo(&snac, xs_dict_get(object, "object")); | ||
| 2381 | |||
| 2382 | following_del(&snac, group); | ||
| 2383 | |||
| 2384 | enqueue_output_by_actor(&snac, msg, group, 0); | ||
| 2385 | |||
| 2386 | snac_log(&snac, xs_fmt("unfollowed group %s", group)); | ||
| 2387 | } | ||
| 2388 | else | ||
| 2389 | snac_log(&snac, xs_fmt("actor is not being followed %s", actor)); | ||
| 2390 | } | ||
| 2391 | else | ||
| 2361 | if (strcmp(action, L("Delete")) == 0) { /** **/ | 2392 | if (strcmp(action, L("Delete")) == 0) { /** **/ |
| 2362 | char *actor_form = xs_dict_get(p_vars, "actor-form"); | 2393 | char *actor_form = xs_dict_get(p_vars, "actor-form"); |
| 2363 | if (actor_form != NULL) { | 2394 | if (actor_form != NULL) { |