[evolution] EHTTPRequest: Use e_mail_ui_session_check_known_address_sync().



commit d509f21104b58e7e255807c40cb19c1831e81cbd
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Feb 27 08:26:38 2013 -0500

    EHTTPRequest: Use e_mail_ui_session_check_known_address_sync().
    
    Use e_mail_ui_session_check_known_address_sync() to help determine
    whether to automatically display images in a text/html MIME part.

 mail/e-http-request.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/mail/e-http-request.c b/mail/e-http-request.c
index 5c4b638..0d6ccc2 100644
--- a/mail/e-http-request.c
+++ b/mail/e-http-request.c
@@ -37,6 +37,8 @@
 
 #include <shell/e-shell.h>
 
+#include "e-mail-ui-session.h"
+
 #define d(x)
 
 #define E_HTTP_REQUEST_GET_PRIVATE(obj) \
@@ -288,17 +290,34 @@ handle_http_request (GSimpleAsyncResult *res,
 
                part_list = camel_object_bag_get (registry, decoded_uri);
                if (part_list) {
-                       EShell *shell;
-                       ESourceRegistry *registry;
+                       EShellBackend *shell_backend;
+                       EMailBackend *backend;
+                       EMailSession *session;
                        CamelInternetAddress *addr;
                        CamelMimeMessage *message;
+                       gboolean known_address = FALSE;
+                       GError *error = NULL;
+
+                       shell_backend =
+                               e_shell_get_backend_by_name (shell, "mail");
+                       backend = E_MAIL_BACKEND (shell_backend);
+                       session = e_mail_backend_get_session (backend);
 
-                       shell = e_shell_get_default ();
-                       registry = e_shell_get_registry (shell);
                        message = e_mail_part_list_get_message (part_list);
                        addr = camel_mime_message_get_from (message);
-                       force_load_images = em_utils_in_addressbook (
-                               registry, addr, FALSE, cancellable);
+
+                       e_mail_ui_session_check_known_address_sync (
+                               E_MAIL_UI_SESSION (session),
+                               addr, FALSE, cancellable,
+                               &known_address, &error);
+
+                       if (error != NULL) {
+                               g_warning ("%s: %s", G_STRFUNC, error->message);
+                               g_error_free (error);
+                       }
+
+                       if (known_address)
+                               force_load_images = TRUE;
 
                        g_object_unref (part_list);
                }


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