aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-ui-session.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-02-27 21:03:22 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-02-27 23:59:55 +0800
commit0b2607486ee7207d524ba6edc3dc375e518ef427 (patch)
tree63fe21da5e0cfee40588963817bda177cc2974d6 /mail/e-mail-ui-session.c
parentef355cd5c3380b057d69bd839f67dc82a666ad9a (diff)
downloadgsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar.gz
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar.bz2
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar.lz
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar.xz
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.tar.zst
gsoc2013-evolution-0b2607486ee7207d524ba6edc3dc375e518ef427.zip
Move CamelSession.lookup_addressbook() handler to EMailUISession.
Have the new handler call e_mail_ui_session_check_known_address_sync() instead of em_utils_in_addressbook().
Diffstat (limited to 'mail/e-mail-ui-session.c')
-rw-r--r--mail/e-mail-ui-session.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index 978e78b1bd..b9e2690744 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -700,6 +700,44 @@ mail_ui_session_get_filter_driver (CamelSession *session,
session, type, error);
}
+static gboolean
+mail_ui_session_lookup_addressbook (CamelSession *session,
+ const gchar *name)
+{
+ CamelInternetAddress *cia;
+ gboolean known_address = FALSE;
+
+ /* FIXME CamelSession's lookup_addressbook() method needs redone.
+ * No GCancellable provided, no means of reporting an error. */
+
+ if (!mail_config_get_lookup_book ())
+ return FALSE;
+
+ cia = camel_internet_address_new ();
+
+ if (camel_address_decode (CAMEL_ADDRESS (cia), name) > 0) {
+ GError *error = NULL;
+
+ e_mail_ui_session_check_known_address_sync (
+ E_MAIL_UI_SESSION (session), cia,
+ mail_config_get_lookup_book_local_only (),
+ NULL, &known_address, &error);
+
+ if (error != NULL) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+ } else {
+ g_warning (
+ "%s: Failed to decode internet "
+ "address '%s'", G_STRFUNC, name);
+ }
+
+ g_object_unref (cia);
+
+ return known_address;
+}
+
static void
mail_ui_session_refresh_service (EMailSession *session,
CamelService *service)
@@ -733,6 +771,7 @@ e_mail_ui_session_class_init (EMailUISessionClass *class)
session_class->remove_service = mail_ui_session_remove_service;
session_class->alert_user = e_mail_ui_session_alert_user;
session_class->get_filter_driver = mail_ui_session_get_filter_driver;
+ session_class->lookup_addressbook = mail_ui_session_lookup_addressbook;
mail_session_class = E_MAIL_SESSION_CLASS (class);
mail_session_class->create_vfolder_context = mail_ui_session_create_vfolder_context;