From c6f7c7dd56129ce9f96dfbe17e9a0265febcd089 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 12 Jan 2016 16:39:31 +0100 Subject: [PATCH] Implement initial_sync --- src/matrix-http-api.c | 27 +++++++++++++++++++++++++++ src/test-client.c | 2 ++ 2 files changed, 29 insertions(+) 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