From 428bc3f5208923c7ed77f4361d385d3858149efc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sergio=20Villar=20Sen=C3=ADn?= Date: Wed, 29 Apr 2009 16:31:25 +0200 Subject: [PATCH] Fixes NB#113192, add mailer addresses to the address book after sending --- src/hildon2/modest-address-book.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/hildon2/modest-address-book.c b/src/hildon2/modest-address-book.c index 5fa4bb3..0cd0ca8 100644 --- a/src/hildon2/modest-address-book.c +++ b/src/hildon2/modest-address-book.c @@ -728,10 +728,26 @@ async_get_contacts_cb (EBook *book, /* Add new or commit existing contact */ if (contact) { to_commit_contacts = g_list_prepend (to_commit_contacts, contact); - g_debug ("Preparing to commit contact %s", address); + g_debug ("----Preparing to commit contact %s", address); } else { + gchar *email_address, *display_address; + + /* Create new contact and add it to the list */ + contact = e_contact_new (); + email_address = modest_text_utils_get_email_address (address); + e_contact_set (contact, E_CONTACT_EMAIL_1, email_address); + g_free (email_address); + + display_address = g_strdup (address); + if (display_address) { + modest_text_utils_get_display_address (display_address); + if ((display_address[0] != '\0') && (strlen (display_address) != strlen (address))) + e_contact_set (contact, E_CONTACT_FULL_NAME, (const gpointer)display_address); + g_free (display_address); + } + to_add_contacts = g_list_prepend (to_add_contacts, contact); - g_debug ("Preparing to add contact %s", address); + g_debug ("----Preparing to add contact %s", address); } iter = g_slist_next (iter); @@ -758,7 +774,6 @@ async_get_contacts_cb (EBook *book, g_list_foreach (contacts, (GFunc) g_object_unref, NULL); g_list_free (contacts); } - } @@ -789,7 +804,7 @@ add_to_address_book (GSList *addresses) composite_query = e_book_query_or (num_add, queries, TRUE); /* Asynchronously retrieve contacts */ - e_book_async_get_contacts (book, composite_query, async_get_contacts_cb, NULL); + e_book_async_get_contacts (book, composite_query, async_get_contacts_cb, addresses); /* Frees. This will unref the subqueries as well */ e_book_query_unref (composite_query); -- 1.7.9.5