aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2010-08-09 18:27:47 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2010-08-13 22:22:22 +0800
commit2f63c0828065d86239a6ff6ebbb8b07ddc929046 (patch)
treec5debed3a230136c17064599e87f1279c69cf3a6
parentce6b6bc1f8662ff24ec44fb76e869394b3f64328 (diff)
downloadgsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar.gz
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar.bz2
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar.lz
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar.xz
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.tar.zst
gsoc2013-empathy-2f63c0828065d86239a6ff6ebbb8b07ddc929046.zip
Update for the new tp-spec API
-rw-r--r--libempathy/empathy-tls-certificate.c70
-rw-r--r--libempathy/empathy-tls-certificate.h3
2 files changed, 66 insertions, 7 deletions
diff --git a/libempathy/empathy-tls-certificate.c b/libempathy/empathy-tls-certificate.c
index 84103fc29..01ae25cd6 100644
--- a/libempathy/empathy-tls-certificate.c
+++ b/libempathy/empathy-tls-certificate.c
@@ -295,16 +295,16 @@ empathy_tls_certificate_class_init (EmpathyTLSCertificateClass *klass)
pspec = g_param_spec_uint ("state", "State",
"The state of this certificate.",
- EMP_TLS_CERTIFICATE_STATE_NONE, NUM_EMP_TLS_CERTIFICATE_STATES -1,
- EMP_TLS_CERTIFICATE_STATE_NONE,
+ EMP_TLS_CERTIFICATE_STATE_PENDING, NUM_EMP_TLS_CERTIFICATE_STATES -1,
+ EMP_TLS_CERTIFICATE_STATE_PENDING,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_STATE, pspec);
pspec = g_param_spec_uint ("reject-reason", "Reject reason",
"The reason why this certificate was rejected.",
- EMP_TLS_CERTIFICATE_REJECT_REASON_NONE,
+ EMP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN,
NUM_EMP_TLS_CERTIFICATE_REJECT_REASONS -1,
- EMP_TLS_CERTIFICATE_REJECT_REASON_NONE,
+ EMP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_REJECT_REASON, pspec);
}
@@ -333,6 +333,54 @@ cert_proxy_reject_cb (TpProxy *proxy,
DEBUG ("Error was %s", error->message);
}
+static const gchar *
+reject_reason_get_dbus_error (EmpTLSCertificateRejectReason reason)
+{
+ const gchar *retval = NULL;
+
+ switch (reason)
+ {
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_UNKNOWN:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_INVALID);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_UNTRUSTED:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_UNTRUSTED);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_EXPIRED:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_EXPIRED);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_NOT_ACTIVATED:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_NOT_ACTIVATED);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_FINGERPRINT_MISMATCH:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_FINGERPRINT_MISMATCH);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_HOSTNAME_MISMATCH:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_HOSTNAME_MISMATCH);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED:
+ retval = tp_error_get_dbus_name (TP_ERROR_CERT_SELF_SIGNED);
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_REVOKED:
+ /* FIXME */
+ retval = "org.freedesktop.Telepathy.Error.Cert.Revoked";
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_INSECURE:
+ /* FIXME */
+ retval = "org.freedesktop.Telepathy.Error.Cert.Insecure";
+ break;
+ case EMP_TLS_CERTIFICATE_REJECT_REASON_LIMIT_EXCEEDED:
+ /* FIXME */
+ retval = "org.freedesktop.Telepathy.Error.Cert.LimitExceeded";
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ return retval;
+}
+
void
empathy_tls_certificate_new_async (const gchar *bus_name,
const gchar *object_path,
@@ -380,14 +428,24 @@ empathy_tls_certificate_accept (EmpathyTLSCertificate *self)
void
empathy_tls_certificate_reject (EmpathyTLSCertificate *self,
- EmpTLSCertificateRejectReason reason)
+ EmpTLSCertificateRejectReason reason,
+ gboolean user_requested)
{
+ GHashTable *details;
+ const gchar *dbus_error;
EmpathyTLSCertificatePriv *priv = GET_PRIV (self);
g_assert (EMPATHY_IS_TLS_CERTIFICATE (self));
DEBUG ("Rejecting TLS certificate with reason %u", reason);
+ dbus_error = reject_reason_get_dbus_error (reason);
+ details = tp_asv_new ("user-requested", G_TYPE_BOOLEAN, user_requested,
+ NULL);
+
emp_cli_authentication_tls_certificate_call_reject (priv->proxy,
- -1, reason, cert_proxy_reject_cb, NULL, NULL, G_OBJECT (self));
+ -1, reason, dbus_error, details,
+ cert_proxy_reject_cb, NULL, NULL, G_OBJECT (self));
+
+ g_hash_table_unref (details);
}
diff --git a/libempathy/empathy-tls-certificate.h b/libempathy/empathy-tls-certificate.h
index 473134044..c79c26abd 100644
--- a/libempathy/empathy-tls-certificate.h
+++ b/libempathy/empathy-tls-certificate.h
@@ -68,7 +68,8 @@ EmpathyTLSCertificate * empathy_tls_certificate_new_finish (GAsyncResult * res,
void empathy_tls_certificate_accept (EmpathyTLSCertificate *self);
void empathy_tls_certificate_reject (EmpathyTLSCertificate *self,
- EmpTLSCertificateRejectReason reason);
+ EmpTLSCertificateRejectReason reason,
+ gboolean user_requested);
G_END_DECLS