From eba28b652035823c74eea521f0e7496ff36fe1f8 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 17 Nov 2020 16:49:49 +0000 Subject: [PATCH] libfwupd: Add fwupd_client_get_user_agent() If we set a property, we should probably have a way to read it back... --- libfwupd/fwupd-client.c | 20 ++++++++++++++++++++ libfwupd/fwupd-client.h | 1 + libfwupd/fwupd.map | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/libfwupd/fwupd-client.c b/libfwupd/fwupd-client.c index 5a0de1b4a..30672383a 100644 --- a/libfwupd/fwupd-client.c +++ b/libfwupd/fwupd-client.c @@ -3861,6 +3861,26 @@ fwupd_client_set_user_agent (FwupdClient *self, const gchar *user_agent) priv->user_agent = g_strdup (user_agent); } +/** + * fwupd_client_get_user_agent: + * @self: A #FwupdClient + * + * Gets the string that represents the user agent that is used for + * uploading and downloading. The user agent will contain the runtime + * version of fwupd somewhere in the provided string. + * + * Returns: a string, or %NULL for unknown. + * + * Since: 1.5.2 + **/ +const gchar * +fwupd_client_get_user_agent (FwupdClient *self) +{ + FwupdClientPrivate *priv = GET_PRIVATE (self); + g_return_val_if_fail (FWUPD_IS_CLIENT (self), NULL); + return priv->user_agent; +} + /** * fwupd_client_set_user_agent_for_package: * @self: A #FwupdClient diff --git a/libfwupd/fwupd-client.h b/libfwupd/fwupd-client.h index 6899df329..891c2f85e 100644 --- a/libfwupd/fwupd-client.h +++ b/libfwupd/fwupd-client.h @@ -355,6 +355,7 @@ void fwupd_client_set_feature_flags_async (FwupdClient *self, gboolean fwupd_client_set_feature_flags_finish (FwupdClient *self, GAsyncResult *res, GError **error); +const gchar *fwupd_client_get_user_agent (FwupdClient *self); void fwupd_client_set_user_agent (FwupdClient *self, const gchar *user_agent); void fwupd_client_set_user_agent_for_package(FwupdClient *self, diff --git a/libfwupd/fwupd.map b/libfwupd/fwupd.map index 632f26faa..18cdd25ba 100644 --- a/libfwupd/fwupd.map +++ b/libfwupd/fwupd.map @@ -616,3 +616,9 @@ LIBFWUPD_1.5.1 { fwupd_device_add_child; local: *; } LIBFWUPD_1.5.0; + +LIBFWUPD_1.5.2 { + global: + fwupd_client_get_user_agent; + local: *; +} LIBFWUPD_1.5.1;