[empathy] use tp_channel_dup_immutable_properties()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] use tp_channel_dup_immutable_properties()
- Date: Tue, 11 Sep 2012 13:19:35 +0000 (UTC)
commit 8fe7c7a2348dcfc1f7833eb84264e9437d5795e8
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Sep 11 14:10:22 2012 +0200
use tp_channel_dup_immutable_properties()
tp_channel_borrow_immutable_properties() has been deprecated.
libempathy/empathy-sasl-mechanisms.c | 19 ++++++++++-----
libempathy/empathy-server-sasl-handler.c | 15 ++++++-----
libempathy/empathy-server-tls-handler.c | 36 +++++++++++++++---------------
3 files changed, 39 insertions(+), 31 deletions(-)
---
diff --git a/libempathy/empathy-sasl-mechanisms.c b/libempathy/empathy-sasl-mechanisms.c
index b900fa5..3eaa010 100644
--- a/libempathy/empathy-sasl-mechanisms.c
+++ b/libempathy/empathy-sasl-mechanisms.c
@@ -344,15 +344,22 @@ gboolean
empathy_sasl_channel_supports_mechanism (TpChannel *channel,
const gchar *mechanism)
{
- GHashTable *props;
- const gchar * const *available_mechanisms;
+ GVariant *props;
+ GStrv available_mechanisms;
+ gboolean result;
- props = tp_channel_borrow_immutable_properties (channel);
- available_mechanisms = tp_asv_get_boxed (props,
+ props = tp_channel_dup_immutable_properties (channel);
+
+ g_variant_lookup (props,
TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_AVAILABLE_MECHANISMS,
- G_TYPE_STRV);
+ "^as", &available_mechanisms);
+
+ result = tp_strv_contains ((const gchar * const *) available_mechanisms,
+ mechanism);
- return tp_strv_contains (available_mechanisms, mechanism);
+ g_variant_unref (props);
+ g_strfreev (available_mechanisms);
+ return result;
}
EmpathySaslMechanism
diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c
index 8e767c5..aa0760d 100644
--- a/libempathy/empathy-server-sasl-handler.c
+++ b/libempathy/empathy-server-sasl-handler.c
@@ -373,19 +373,20 @@ static gboolean
channel_has_may_save_response (TpChannel *channel)
{
/* determine if we are permitted to save the password locally */
- gboolean may_save_response, may_save_response_valid;
+ GVariant *props;
+ gboolean may_save_response;
- may_save_response = tp_asv_get_boolean (
- tp_channel_borrow_immutable_properties (channel),
- TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_MAY_SAVE_RESPONSE,
- &may_save_response_valid);
+ props = tp_channel_dup_immutable_properties (channel);
- if (!may_save_response_valid)
+ if (!g_variant_lookup (props,
+ TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_MAY_SAVE_RESPONSE,
+ "b", &may_save_response))
{
DEBUG ("MaySaveResponse unknown, assuming TRUE");
- return TRUE;
+ may_save_response = TRUE;
}
+ g_variant_unref (props);
return may_save_response;
}
diff --git a/libempathy/empathy-server-tls-handler.c b/libempathy/empathy-server-tls-handler.c
index dd3e7bb..14ab1ab 100644
--- a/libempathy/empathy-server-tls-handler.c
+++ b/libempathy/empathy-server-tls-handler.c
@@ -95,10 +95,8 @@ tls_handler_init_async (GAsyncInitable *initable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GHashTable *properties;
+ GVariant *properties;
const gchar *cert_object_path;
- const gchar *hostname;
- const gchar * const *identities;
const gchar *bus_name;
GError *error = NULL;
GQuark features[] = { TP_TLS_CERTIFICATE_FEATURE_CORE, 0 };
@@ -114,42 +112,44 @@ tls_handler_init_async (GAsyncInitable *initable,
priv->async_init_res = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, empathy_server_tls_handler_new_async);
- properties = tp_channel_borrow_immutable_properties (priv->channel);
+ properties = tp_channel_dup_immutable_properties (priv->channel);
- hostname = tp_asv_get_string (properties,
- TP_PROP_CHANNEL_TYPE_SERVER_TLS_CONNECTION_HOSTNAME);
- priv->hostname = g_strdup (hostname);
+ g_variant_lookup (properties,
+ TP_PROP_CHANNEL_TYPE_SERVER_TLS_CONNECTION_HOSTNAME,
+ "s", &priv->hostname);
- DEBUG ("Received hostname: %s", hostname);
+ DEBUG ("Received hostname: %s", priv->hostname);
- identities = tp_asv_get_strv (properties,
- TP_PROP_CHANNEL_TYPE_SERVER_TLS_CONNECTION_REFERENCE_IDENTITIES);
+ g_variant_lookup (properties,
+ TP_PROP_CHANNEL_TYPE_SERVER_TLS_CONNECTION_REFERENCE_IDENTITIES,
+ "^as", &priv->reference_identities);
/*
* If the channel doesn't implement the ReferenceIdentities parameter
* then fallback to the hostname.
*/
- if (identities == NULL)
+ if (priv->reference_identities == NULL)
{
- default_identities[0] = (gchar *) hostname;
+ default_identities[0] = (gchar *) priv->hostname;
default_identities[1] = NULL;
- identities = (const gchar **) default_identities;
+ priv->reference_identities = g_strdupv (default_identities);
}
else
{
#ifdef ENABLE_DEBUG
- gchar *output = g_strjoinv (", ", (gchar **) identities);
+ gchar *output = g_strjoinv (", ", (gchar **) priv->reference_identities);
DEBUG ("Received reference identities: %s", output);
g_free (output);
#endif /* ENABLE_DEBUG */
}
- priv->reference_identities = g_strdupv ((gchar **) identities);
-
- cert_object_path = tp_asv_get_object_path (properties,
- EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".ServerCertificate");
+ g_variant_lookup (properties,
+ EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".ServerCertificate",
+ "&s", &cert_object_path);
bus_name = tp_proxy_get_bus_name (TP_PROXY (priv->channel));
+ g_variant_unref (properties);
+
DEBUG ("Creating an TpTLSCertificate for path %s, bus name %s",
cert_object_path, bus_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]