diff options
author | Richard van der Hoff <richard@matrix.org> | 2015-10-22 18:33:52 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2015-10-22 18:33:52 +0100 |
commit | e6880c64f78a505e07c2ba9feb6397d304b5ed27 (patch) | |
tree | fe00a82ee667df7cca5aa2e5f906520b5cb221a0 /matrix-api.c | |
parent | 0ecf274fefae97a5ee944107bc361d6836ffba63 (diff) | |
download | purple-matrix-e6880c64f78a505e07c2ba9feb6397d304b5ed27.tar.gz |
Update the room state on first message
Now that we persist the next_batch identifier, we no longer get all of the
state for a room, so we need to explicitly fetch it on initial sync.
Diffstat (limited to 'matrix-api.c')
-rw-r--r-- | matrix-api.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/matrix-api.c b/matrix-api.c index 596c49f..590c22c 100644 --- a/matrix-api.c +++ b/matrix-api.c @@ -545,3 +545,27 @@ MatrixApiRequestData *matrix_api_send(MatrixConnectionData *conn, return fetch_data; } + + +MatrixApiRequestData *matrix_api_get_room_state(MatrixConnectionData *conn, + const gchar *room_id, + MatrixApiCallback callback, + gpointer user_data) +{ + GString *url; + MatrixApiRequestData *fetch_data; + + url = g_string_new(conn->homeserver); + g_string_append(url, "/_matrix/client/api/v1/rooms/"); + g_string_append(url, purple_url_encode(room_id)); + g_string_append(url, "/state?access_token="); + g_string_append(url, purple_url_encode(conn->access_token)); + + purple_debug_info("matrixprpl", "getting state for %s\n", room_id); + + fetch_data = matrix_api_start(url->str, NULL, conn, callback, + NULL, NULL, user_data, 10*1024*1024); + g_string_free(url, TRUE); + + return fetch_data; +} |