Implement list_public_rooms

This commit is contained in:
Gergely Polonkai 2016-01-13 10:35:59 +01:00
parent a6ba98ecc6
commit c4cb8bd204
2 changed files with 15 additions and 0 deletions

View File

@ -950,6 +950,18 @@ i_leave_room(MatrixAPI *api,
g_free(path); g_free(path);
} }
static void
i_list_public_rooms(MatrixAPI *api,
MatrixAPICallback callback,
gpointer user_data,
GError **error)
{
_send(MATRIX_HTTP_API(api),
callback, user_data,
"GET", "publicRooms", NULL, NULL,
error);
}
static void static void
matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
{ {
@ -964,4 +976,5 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface)
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; iface->leave_room = i_leave_room;
iface->list_public_rooms = i_list_public_rooms;
} }

View File

@ -93,6 +93,8 @@ login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err)
g_printf("Logged in as %s\n", user_id); g_printf("Logged in as %s\n", user_id);
matrix_api_list_public_rooms(api, NULL, NULL, NULL);
matrix_api_create_room(api, matrix_api_create_room(api,
create_room_finished, NULL, create_room_finished, NULL,
MATRIX_API_ROOM_PRESET_PUBLIC, MATRIX_API_ROOM_PRESET_PUBLIC,