aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-11 20:10:22 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-11 21:10:43 +0800
commit8fe7c7a2348dcfc1f7833eb84264e9437d5795e8 (patch)
treec9a3c1f8b710f760e70595e64a01a32792e5861a /libempathy
parent9a0c691c865b369438ef789638f33fd21aab0551 (diff)
downloadgsoc2013-empathy-8fe7c7a2348dcfc1f7833eb84264e9437d5795e8.tar.gz
gsoc2013-empathy-8fe7c7a2348dcfc1f7833eb84264e9437d5795e8.tar.zst
gsoc2013-empathy-8fe7c7a2348dcfc1f7833eb84264e9437d5795e8.zip
use tp_channel_dup_immutable_properties()
tp_channel_borrow_immutable_properties() has been deprecated.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-sasl-mechanisms.c19
-rw-r--r--libempathy/empathy-server-sasl-handler.c15
-rw-r--r--libempathy/empathy-server-tls-handler.c36
3 files changed, 39 insertions, 31 deletions
diff --git a/libempathy/empathy-sasl-mechanisms.c b/libempathy/empathy-sasl-mechanisms.c
index b900fa5da..3eaa0108d 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 8e767c5a6..aa0760d63 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 dd3e7bb78..14ab1aba7 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);