From 0d8d041cb42e122c72890f3c126ab247ec0a2a1d Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 15:40:33 +0100 Subject: [PATCH] Implement get_room_id --- src/matrix-http-api.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 8c0240c..9659ae1 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -1572,6 +1572,27 @@ i_delete_room_alias(MatrixAPI *api, g_free(path); } +static void +i_get_room_id(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *room_alias, + GError **error) +{ + gchar *encoded_room_alias, *path; + + encoded_room_alias = soup_uri_encode(room_alias, NULL); + path = g_strdup_printf("room/%s", encoded_room_alias); + g_free(encoded_room_alias); + + _send(MATRIX_HTTP_API(api), + callback, user_data, + CALL_API, + "GET", path, NULL, NULL, NULL, NULL, + FALSE, error); + g_free(path); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -1606,7 +1627,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) /* Room directory */ iface->delete_room_alias = i_delete_room_alias; - iface->get_room_id = NULL; + iface->get_room_id = i_get_room_id; iface->create_room_alias = NULL; /* Room discovery */