*/
#include "config.h"
-
#include "empathy-server-tls-handler.h"
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib-dbus.h>
-#define DEBUG_FLAG EMPATHY_DEBUG_TLS
-#include "empathy-debug.h"
-#include "empathy-tls-certificate.h"
#include "empathy-utils.h"
-#include "extensions/extensions.h"
+#define DEBUG_FLAG EMPATHY_DEBUG_TLS
+#include "empathy-debug.h"
static void async_initable_iface_init (GAsyncInitableIface *iface);
typedef struct {
TpChannel *channel;
- EmpathyTLSCertificate *certificate;
+ TpTLSCertificate *certificate;
gchar *hostname;
gchar **reference_identities;
GAsyncResult *result,
gpointer user_data)
{
- EmpathyTLSCertificate *certificate = EMPATHY_TLS_CERTIFICATE (source);
+ TpTLSCertificate *certificate = TP_TLS_CERTIFICATE (source);
EmpathyServerTLSHandler *self = user_data;
GError *error = NULL;
EmpathyServerTLSHandlerPriv *priv = GET_PRIV (self);
- empathy_tls_certificate_prepare_finish (certificate, result, &error);
-
- if (error != NULL)
+ if (!tp_proxy_prepare_finish (certificate, result, &error))
{
g_simple_async_result_set_from_error (priv->async_init_res, error);
g_error_free (error);
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;
- TpDBusDaemon *dbus;
GError *error = NULL;
+ GQuark features[] = { TP_TLS_CERTIFICATE_FEATURE_CORE, 0 };
/*
* Used when channel doesn't implement ReferenceIdentities. A GStrv
* with [0] the hostname, and [1] a NULL terminator.
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,
+ TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".ServerCertificate",
+ "&o", &cert_object_path);
bus_name = tp_proxy_get_bus_name (TP_PROXY (priv->channel));
- dbus = tp_proxy_get_dbus_daemon (TP_PROXY (priv->channel));
- DEBUG ("Creating an EmpathyTLSCertificate for path %s, bus name %s",
+ DEBUG ("Creating an TpTLSCertificate for path %s, bus name %s",
cert_object_path, bus_name);
- priv->certificate = empathy_tls_certificate_new (dbus, bus_name,
+ priv->certificate = tp_tls_certificate_new (TP_PROXY (priv->channel),
cert_object_path, &error);
+ g_variant_unref (properties);
+
if (error != NULL)
{
- DEBUG ("Unable to create the EmpathyTLSCertificate: error %s",
+ DEBUG ("Unable to create the TpTLSCertificate: error %s",
error->message);
g_simple_async_result_set_from_error (priv->async_init_res, error);
return;
}
- empathy_tls_certificate_prepare_async (priv->certificate,
+ tp_proxy_prepare_async (priv->certificate, features,
tls_certificate_prepared_cb, self);
}
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_CHANNEL, pspec);
- pspec = g_param_spec_object ("certificate", "The EmpathyTLSCertificate",
- "The EmpathyTLSCertificate carried by the channel.",
- EMPATHY_TYPE_TLS_CERTIFICATE,
+ pspec = g_param_spec_object ("certificate", "The TpTLSCertificate",
+ "The TpTLSCertificate carried by the channel.",
+ TP_TYPE_TLS_CERTIFICATE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_TLS_CERTIFICATE, pspec);
return NULL;
}
-EmpathyTLSCertificate *
+TpTLSCertificate *
empathy_server_tls_handler_get_certificate (EmpathyServerTLSHandler *self)
{
EmpathyServerTLSHandlerPriv *priv = GET_PRIV (self);