From fb3bfd9d702eab13cd22c9d9d8845b4cdb220b6d Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 20:43:55 +0100 Subject: [PATCH] Implement get_profile --- src/matrix-http-api.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 5002dba..af724ee 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -2380,6 +2380,27 @@ i_change_password(MatrixAPI *api, FALSE, error); } +static void +i_get_profile(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *user_id, + GError **error) +{ + gchar *encoded_user_id, *path; + + encoded_user_id = soup_uri_encode(user_id, NULL); + path = g_strdup_printf("profile/%s", encoded_user_id); + g_free(encoded_user_id); + + _send(MATRIX_HTTP_API(api), + callback, user_data, + CALL_API, + "GET", path, NULL, NULL, NULL, NULL, + FALSE, error); + g_free(path); +} + static void matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) { @@ -2460,7 +2481,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->get_3pids = i_get_3pids; iface->add_3pid = i_add_3pid; iface->change_password = i_change_password; - iface->get_profile = NULL; + iface->get_profile = i_get_profile; iface->get_avatar_url = NULL; iface->set_avatar_url = NULL; iface->get_display_name = NULL;