Implement get_room_id

This commit is contained in:
Gergely Polonkai 2016-01-15 15:40:33 +01:00
parent e0fcbae86b
commit 0d8d041cb4

View File

@ -1572,6 +1572,27 @@ i_delete_room_alias(MatrixAPI *api,
g_free(path); 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 static void
matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
{ {
@ -1606,7 +1627,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
/* Room directory */ /* Room directory */
iface->delete_room_alias = i_delete_room_alias; 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; iface->create_room_alias = NULL;
/* Room discovery */ /* Room discovery */