commit d4695a9

default  ·  2023-05-18 07:46:21 +0000 UTC
parent 3738ecc
Mastoapi: added block / unblock.
1 files changed,  +20, -0
+20, -0
 1@@ -2014,6 +2014,26 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
 2                         }
 3                     }
 4                 }
 5+                else
 6+                if (strcmp(opt, "block") == 0) { /** **/
 7+                    if (valid_status(object_get_by_md5(md5, &actor_o))) {
 8+                        const char *actor = xs_dict_get(actor_o, "id");
 9+
10+                        mute(&snac, actor);
11+
12+                        rsp = mastoapi_relationship(&snac, md5);
13+                    }
14+                }
15+                else
16+                if (strcmp(opt, "unblock") == 0) { /** **/
17+                    if (valid_status(object_get_by_md5(md5, &actor_o))) {
18+                        const char *actor = xs_dict_get(actor_o, "id");
19+
20+                        unmute(&snac, actor);
21+
22+                        rsp = mastoapi_relationship(&snac, md5);
23+                    }
24+                }
25             }
26 
27             if (rsp != NULL) {