telepathy-glib: tp_tls_certificate_reject_async: allow a D-Bus error name to be specified

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Wed May 9 03:15:57 PDT 2012


Module: telepathy-glib
Branch: master
Commit: 43978342cf1925fac3eca5cb2e4d235334228a76
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=43978342cf1925fac3eca5cb2e4d235334228a76

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Dec 15 12:13:54 2010 +0000

tp_tls_certificate_reject_async: allow a D-Bus error name to be specified

---

 telepathy-glib/tls-certificate.c |   13 +++++++++++--
 telepathy-glib/tls-certificate.h |    1 +
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/telepathy-glib/tls-certificate.c b/telepathy-glib/tls-certificate.c
index 871896d..1041baa 100644
--- a/telepathy-glib/tls-certificate.c
+++ b/telepathy-glib/tls-certificate.c
@@ -569,15 +569,19 @@ tp_tls_certificate_accept_finish (TpTLSCertificate *self,
 
 static GPtrArray *
 build_rejections_array (TpTLSCertificateRejectReason reason,
+    const gchar *dbus_error,
     GHashTable *details)
 {
   GPtrArray *retval;
   GValueArray *rejection;
 
+  if (dbus_error == NULL)
+    dbus_error = reject_reason_get_dbus_error (reason);
+
   retval = g_ptr_array_new ();
   rejection = tp_value_array_build (3,
       G_TYPE_UINT, reason,
-      G_TYPE_STRING, reject_reason_get_dbus_error (reason),
+      G_TYPE_STRING, dbus_error,
       TP_HASH_TYPE_STRING_VARIANT_MAP, details,
       NULL);
 
@@ -590,6 +594,8 @@ build_rejections_array (TpTLSCertificateRejectReason reason,
  * tp_tls_certificate_reject_async:
  * @self: a TLS certificate
  * @reason: the reason for rejection
+ * @dbus_error: a D-Bus error name such as %TP_ERROR_STR_CERT_REVOKED, or
+ *  %NULL to derive one from @reason
  * @details: (transfer none) (element-type utf8 GObject.Value): details of the
  *  rejection
  * @callback: called on success or failure
@@ -604,6 +610,7 @@ build_rejections_array (TpTLSCertificateRejectReason reason,
 void
 tp_tls_certificate_reject_async (TpTLSCertificate *self,
     TpTLSCertificateRejectReason reason,
+    const gchar *dbus_error,
     GHashTable *details,
     GAsyncReadyCallback callback,
     gpointer user_data)
@@ -611,7 +618,9 @@ tp_tls_certificate_reject_async (TpTLSCertificate *self,
   GPtrArray *rejections;
   GSimpleAsyncResult *reject_result;
 
-  g_assert (TP_IS_TLS_CERTIFICATE (self));
+  g_return_if_fail (TP_IS_TLS_CERTIFICATE (self));
+  g_return_if_fail (dbus_error == NULL ||
+      tp_dbus_check_valid_interface_name (dbus_error, NULL));
 
   DEBUG ("Rejecting TLS certificate with reason %u", reason);
 
diff --git a/telepathy-glib/tls-certificate.h b/telepathy-glib/tls-certificate.h
index 0a28874..300a9ae 100644
--- a/telepathy-glib/tls-certificate.h
+++ b/telepathy-glib/tls-certificate.h
@@ -85,6 +85,7 @@ gboolean tp_tls_certificate_accept_finish (TpTLSCertificate *self,
 
 void tp_tls_certificate_reject_async (TpTLSCertificate *self,
     TpTLSCertificateRejectReason reason,
+    const gchar *dbus_error,
     GHashTable *details,
     GAsyncReadyCallback callback,
     gpointer user_data);



More information about the telepathy-commits mailing list