From 46b5f5d9181cd4ecf1ebdad7794bbb7b5b61b4c5 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 18:55:49 +0100 Subject: [PATCH] Implement whois --- 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 f041a5d..73ab941 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -2224,6 +2224,27 @@ i_download_filter(MatrixAPI *api, g_free(path); } +static void +i_whois(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("admin/whois/%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) { @@ -2293,7 +2314,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) /* Search */ /* Server administration */ - iface->whois = NULL; + iface->whois = i_whois; iface->versions = NULL; /* Session management */