Implement leave_room

This commit is contained in:
Gergely Polonkai 2016-01-13 09:55:33 +01:00
parent 48ce66e73d
commit a6ba98ecc6

View File

@ -930,6 +930,26 @@ i_event_stream(MatrixAPI *api,
err); 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 static void
matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) 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->create_room = i_create_room;
iface->initial_sync = i_initial_sync; iface->initial_sync = i_initial_sync;
iface->event_stream = i_event_stream; iface->event_stream = i_event_stream;
iface->leave_room = i_leave_room;
} }