From 1cdda64f474784743cc8876301e4c709c560b174 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sat, 16 Jan 2016 15:18:18 +0100 Subject: [PATCH] Implement delete_room_tag --- src/matrix-http-api.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 861da20..33e6ed9 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -2621,6 +2621,34 @@ i_get_room_tags(MatrixAPI *api, g_free(path); } +static void +i_delete_room_tag(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *user_id, + const gchar *room_id, + const gchar *tag, + GError **error) +{ + gchar *encoded_user_id, *encoded_room_id, *encoded_tag, *path; + + encoded_user_id = soup_uri_encode(user_id, NULL); + encoded_room_id = soup_uri_encode(room_id, NULL); + encoded_tag = soup_uri_encode(tag, NULL); + path = g_strdup_printf("user/%s/rooms/%s/tags/%s", + encoded_user_id, encoded_room_id, encoded_tag); + g_free(encoded_user_id); + g_free(encoded_room_id); + g_free(encoded_tag); + + _send(MATRIX_HTTP_API(api), + callback, user_data, + CALL_API, + "DELETE", path, NULL, NULL, NULL, NULL, + FALSE, error); + g_free(path); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -2709,7 +2737,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->register_account = i_register_account; iface->set_account_data = i_set_account_data; iface->get_room_tags = i_get_room_tags; - iface->delete_room_tag = NULL; + iface->delete_room_tag = i_delete_room_tag; iface->add_room_tag = NULL; /* VoIP */