return selected_email_addr_list;
}
+/* Assumes that the second argument (the user provided one) is a pure
+ email address without name */
+static gint
+compare_addresses (const gchar *address1,
+ const gchar *mail2)
+{
+ gint retval;
+ gchar *mail1;
+
+ mail1 = modest_text_utils_get_email_address (address1);
+ retval = g_strcmp0 (mail1, mail2);
+ g_free (mail1);
+
+ return retval;
+}
+
static EContact *
get_contact_for_address (GList *contacts,
const gchar *address)
{
EContact *retval = NULL, *contact;
GList *iter;
+ gchar *email;
+ email = modest_text_utils_get_email_address (address);
iter = contacts;
while (iter && !retval) {
GList *emails = NULL;
emails = e_contact_get (contact, E_CONTACT_EMAIL);
if (emails) {
/* Look for the email address */
- if (g_list_find_custom (emails, address, (GCompareFunc) g_strcmp0))
+ if (g_list_find_custom (emails, email, (GCompareFunc) compare_addresses))
retval = contact;
/* Free the list */
}
iter = g_list_next (iter);
}
+ g_free (email);
+
return retval;
}
{
OssoABookSelfContact *self_contact = osso_abook_self_contact_get_default ();
- return osso_abook_contact_get_display_name (OSSO_ABOOK_CONTACT (self_contact));
+ /* We are not using osso_abook_contact_get_display_name
+ because that method fallbacks to another fields if the name
+ is not defined */
+ if (self_contact)
+ if (OSSO_ABOOK_IS_CONTACT (self_contact))
+ return osso_abook_contact_get_name ((OssoABookContact*)self_contact);
+ else
+ return e_contact_get ((EContact *) self_contact, E_CONTACT_NAME);
+ else
+ return NULL;
}