[evolution] Adapt to CamelSession trust_prompt() changes.



commit 2ff0a3ccf07e653bd169ab0721ad1b72bbfe3a68
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Sep 27 08:22:05 2013 -0400

    Adapt to CamelSession trust_prompt() changes.

 libemail-engine/e-mail-session.c |   49 +++++++++++++++++++++-----------------
 mail/e-mail-ui-session.c         |   12 ++++-----
 mail/e-mail-ui-session.h         |    8 ++----
 3 files changed, 35 insertions(+), 34 deletions(-)
---
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 0dfa7ed..c68a10e 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -1404,42 +1404,48 @@ mail_session_alert_user (CamelSession *session,
 
 static CamelCertTrust
 mail_session_trust_prompt (CamelSession *session,
-                           const gchar *host,
-                           const gchar *certificate,
-                           guint32 certificate_errors,
-                           GList *issuers,
-                           GCancellable *cancellable)
+                           CamelService *service,
+                           GTlsCertificate *certificate,
+                           GTlsCertificateFlags errors)
 {
        EUserPrompter *prompter;
        ENamedParameters *parameters;
+       CamelSettings *settings;
        CamelCertTrust response;
-       gchar *errors_code;
-       GList *iter;
+       GByteArray *der = NULL;
+       gchar *base64;
+       gchar *errhex;
+       gchar *host;
        gint button_index;
-       gint ii;
 
        prompter = e_user_prompter_new ();
        parameters = e_named_parameters_new ();
-       errors_code = g_strdup_printf ("%x", certificate_errors);
 
-       e_named_parameters_set (parameters, "host", host);
-       e_named_parameters_set (parameters, "certificate", certificate);
-       e_named_parameters_set (parameters, "certificate-errors", errors_code);
+       settings = camel_service_ref_settings (service);
+       g_return_val_if_fail (CAMEL_IS_NETWORK_SETTINGS (settings), 0);
+       host = camel_network_settings_dup_host (
+               CAMEL_NETWORK_SETTINGS (settings));
+       g_object_unref (settings);
 
-       for (ii = 1, iter = issuers; iter; ii++, iter = iter->next) {
-               gchar *name;
+       /* XXX No accessor function for this property. */
+       g_object_get (certificate, "certificate", &der, NULL);
+       g_return_val_if_fail (der != NULL, 0);
+       base64 = g_base64_encode (der->data, der->len);
+       g_byte_array_unref (der);
 
-               if (!iter->data)
-                       break;
+       errhex = g_strdup_printf ("%x", (gint) errors);
 
-               name = g_strdup_printf ("issuer-%d", ii);
-               e_named_parameters_set (parameters, name, iter->data);
-               g_free (name);
-       }
+       e_named_parameters_set (parameters, "host", host);
+       e_named_parameters_set (parameters, "certificate", base64);
+       e_named_parameters_set (parameters, "certificate-errors", errhex);
+
+       g_free (host);
+       g_free (base64);
+       g_free (errhex);
 
        button_index = e_user_prompter_extension_prompt_sync (
                prompter, "ETrustPrompt::trust-prompt",
-               parameters, NULL, cancellable, NULL);
+               parameters, NULL, NULL, NULL);
 
        switch (button_index) {
                case 0:
@@ -1456,7 +1462,6 @@ mail_session_trust_prompt (CamelSession *session,
                        break;
        }
 
-       g_free (errors_code);
        e_named_parameters_free (parameters);
        g_object_unref (prompter);
 
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index b9e2690..f76b94c 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -678,16 +678,14 @@ e_mail_ui_session_alert_user (CamelSession *session,
 
 CamelCertTrust
 e_mail_ui_session_trust_prompt (CamelSession *session,
-                                const gchar *host,
-                                const gchar *certificate,
-                                guint32 certificate_errors,
-                                GList *issuers,
-                                GCancellable *cancellable)
+                                CamelService *service,
+                                GTlsCertificate *certificate,
+                                GTlsCertificateFlags errors)
 {
        g_type_ensure (E_TYPE_MAIL_UI_SESSION);
 
-       return CAMEL_SESSION_CLASS (e_mail_ui_session_parent_class)->trust_prompt (
-               session, host, certificate, certificate_errors, issuers, cancellable);
+       return CAMEL_SESSION_CLASS (e_mail_ui_session_parent_class)->
+               trust_prompt (session, service, certificate, errors);
 }
 
 static CamelFilterDriver *
diff --git a/mail/e-mail-ui-session.h b/mail/e-mail-ui-session.h
index 9950219..c73338c 100644
--- a/mail/e-mail-ui-session.h
+++ b/mail/e-mail-ui-session.h
@@ -92,11 +92,9 @@ gint         e_mail_ui_session_alert_user    (CamelSession *session,
                                                 GList *button_captions,
                                                 GCancellable *cancellable);
 CamelCertTrust e_mail_ui_session_trust_prompt  (CamelSession *session,
-                                                const gchar *host,
-                                                const gchar *certificate,
-                                                guint32 certificate_errors,
-                                                GList *issuers,
-                                                GCancellable *cancellable);
+                                                CamelService *service,
+                                                GTlsCertificate *certificate,
+                                                GTlsCertificateFlags errors);
 gboolean       e_mail_ui_session_check_known_address_sync
                                                (EMailUISession *session,
                                                 CamelInternetAddress *addr,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]