From 13c8707dbf24b85524b875875c5fc87ad20ff038 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 19:21:33 +0100 Subject: [PATCH] Update MatrixAPI with the versions API call --- src/matrix-api.c | 24 ++++++++++++++++++++++++ src/matrix-api.h | 8 ++++++++ src/matrix-http-api.c | 1 + 3 files changed, 33 insertions(+) diff --git a/src/matrix-api.c b/src/matrix-api.c index 244db7f..2dabe92 100644 --- a/src/matrix-api.c +++ b/src/matrix-api.c @@ -83,6 +83,7 @@ * @create_filter: virtual function for matrix_api_create_filter() * @download_filter: virtual function for matrix_api_download_filter() * @whois: virtual function for matrix_api_whois() + * @versions: virtual function for matrix_api_versions() * @login: virtual function for matrix_api_login() * @token_refresh: virtual function for matrix_api_token_refresh() * @get_3pids: virtual function for matrix_api_get_3pids() @@ -1646,6 +1647,29 @@ matrix_api_whois(MatrixAPI *api, ->whois(api, callback, user_data, user_id, error); } +/** + * matrix_api_versions: + * @api: a #MatrixAPI iplementation + * @callback: (scope async): the function to call when the request is + * finished + * @user_data: (closure): user data to pass to the callback function + * @callback + * @error: return location for a #GError, or %NULL + * + * Get the versions of the specification supported by the server. + */ +void +matrix_api_versions(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + GError **error) +{ + g_return_if_fail(MATRIX_IS_API(api)); + + MATRIX_API_GET_IFACE(api) + ->versions(api, callback, user_data, error); +} + /* Session management */ /** diff --git a/src/matrix-api.h b/src/matrix-api.h index 1e16530..f1092a3 100644 --- a/src/matrix-api.h +++ b/src/matrix-api.h @@ -358,6 +358,10 @@ struct _MatrixAPIInterface { gpointer user_data, const gchar *user_id, GError **error); + void (*versions)(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + GError **error); /* Session management */ @@ -774,6 +778,10 @@ void matrix_api_whois(MatrixAPI *api, gpointer user_data, const gchar *user_id, GError **error); +void matrix_api_versions(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + GError **error); /* Session management */ diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 0ab5e25..b9970a1 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -2246,6 +2246,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) /* Server administration */ iface->whois = NULL; + iface->versions = NULL; /* Session management */ iface->login = i_login;