From 079139f01d4a23304e7bba06d4e58b3269898b71 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Wed, 13 Oct 2021 11:09:11 +0300 Subject: [PATCH] client: add _send_error() method --- lib/wp/client.c | 23 +++++++++++++++++++++++ lib/wp/client.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/lib/wp/client.c b/lib/wp/client.c index 8d11e11c..5b2b766e 100644 --- a/lib/wp/client.c +++ b/lib/wp/client.c @@ -110,6 +110,29 @@ wp_client_pw_object_mixin_priv_interface_init ( wp_pw_object_mixin_priv_interface_info_init_no_params (iface, client, CLIENT); } +/*! + * \brief Send an error to the client + * + * \ingroup wpclient + * \param self the client + * \param id the global id to report the error on + * \param res an errno style error code + * \param message the error message string + */ +void +wp_client_send_error (WpClient * self, guint32 id, int res, + const gchar * message) +{ + struct pw_client *pwp; + + g_return_if_fail (WP_IS_CLIENT (self)); + + pwp = (struct pw_client *) wp_proxy_get_pw_proxy (WP_PROXY (self)); + g_return_if_fail (pwp != NULL); + + pw_client_error (pwp, id, res, message); +} + /*! * \brief Update client's permissions on a list of objects. * diff --git a/lib/wp/client.h b/lib/wp/client.h index 6ba41bce..060f5673 100644 --- a/lib/wp/client.h +++ b/lib/wp/client.h @@ -23,6 +23,10 @@ struct pw_permission; WP_API G_DECLARE_FINAL_TYPE (WpClient, wp_client, WP, CLIENT, WpGlobalProxy) +WP_API +void wp_client_send_error (WpClient * self, guint32 id, int res, + const gchar * message); + WP_API void wp_client_update_permissions (WpClient * self, guint n_perm, ...);