From 959efd9d6f3b8dda4eefa38161fa49ed5a12c736 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 15 Jan 2016 15:12:31 +0100 Subject: [PATCH] Implement get_pusher --- src/matrix-http-api.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 0799793..31f6137 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -1386,6 +1386,38 @@ i_delete_pusher(MatrixAPI *api, g_free(path); } +static void +i_get_pusher(MatrixAPI *api, + MatrixAPICallback callback, + gpointer user_data, + const gchar *scope, + MatrixAPIPusherKind kind, + const gchar *rule_id, + GError **error) +{ + gchar *encoded_scope, *encoded_rule_id, *kind_string, *path; + + encoded_scope = soup_uri_encode(scope, NULL); + encoded_rule_id = soup_uri_encode(rule_id, NULL); + kind_string = enum_to_string(MATRIX_TYPE_API_PUSHER_KIND, kind, TRUE); + + path = g_strdup_printf("pushrules/%s/%s/%s", + encoded_scope, + kind_string, + encoded_rule_id); + + g_free(encoded_scope); + g_free(encoded_rule_id); + g_free(kind_string); + + _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) { @@ -1411,7 +1443,7 @@ matrix_http_api_matrix_api_init(MatrixAPIInterface *iface) iface->update_pusher = i_update_pusher; iface->get_pushers = i_get_pushers; iface->delete_pusher = i_delete_pusher; - iface->get_pusher = NULL; + iface->get_pusher = i_get_pusher; iface->add_pusher = NULL; iface->toggle_pusher = NULL;