Implement initial_sync

This commit is contained in:
Gergely Polonkai 2016-01-12 16:39:31 +01:00
parent 78bbf4ef18
commit c6f7c7dd56
2 changed files with 29 additions and 0 deletions

View File

@ -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;
}

View File

@ -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