diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 9df5ea6..eeb3c34 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -843,6 +843,32 @@ i_create_room(MatrixAPI *api, error); } +static void +i_initial_sync(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + guint limit, + gboolean archived, + GError **err) +{ + GHashTable *params; + + params = create_query_params(); + + if (limit != 0) { + g_hash_table_replace(params, "limit", g_strdup_printf("%d", limit)); + } + + if (archived) { + g_hash_table_replace(params, "archived", g_strdup("true")); + } + + _send(MATRIX_HTTP_API(api), + callback, user_data, + "GET", "initialSync", params, NULL, + err); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -854,4 +880,5 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->get_homeserver = i_get_homeserver; iface->login = i_login; iface->create_room = i_create_room; + iface->initial_sync = i_initial_sync; } diff --git a/src/test-client.c b/src/test-client.c index 73c64f6..7f3407d 100644 --- a/src/test-client.c +++ b/src/test-client.c @@ -41,6 +41,8 @@ create_room_finished(MatrixAPI *api, } else { g_printf("Room registered\n"); } + + matrix_api_initial_sync(MATRIX_API(api), NULL, NULL, 10, TRUE, NULL); } static void