diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 71a86cb..15171ad 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -930,6 +930,26 @@ i_event_stream(MatrixAPI *api, err); } +static void +i_leave_room(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *room_id, + GError **error) +{ + gchar *encoded_room_id, *path; + + encoded_room_id = soup_uri_encode(room_id, NULL); + path = g_strdup_printf("rooms/%s/leave", encoded_room_id); + g_free(encoded_room_id); + + _send(MATRIX_HTTP_API(api), + callback, user_data, + "POST", path, NULL, NULL, + error); + g_free(path); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -943,4 +963,5 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->create_room = i_create_room; iface->initial_sync = i_initial_sync; iface->event_stream = i_event_stream; + iface->leave_room = i_leave_room; }