[evolution-patches] Address book: Patch for #303286
- From: Sushma Rai <rsushma novell com>
- To: Evolution patches List <evolution-patches gnome org>
- Subject: [evolution-patches] Address book: Patch for #303286
- Date: Tue, 13 Sep 2005 16:51:39 +0530
Hi,
This patch is to add contacts to address book while replying to the
mail even if the senders address contains only the email id and
not name.
Please review,
Thanks,
Sushma.
Index: plugins/bbdb/bbdb.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/bbdb/bbdb.c,v
retrieving revision 1.9
diff -u -p -r1.9 bbdb.c
--- plugins/bbdb/bbdb.c 28 Jul 2005 09:41:23 -0000 1.9
+++ plugins/bbdb/bbdb.c 13 Sep 2005 11:03:27 -0000
@@ -156,24 +156,26 @@ bbdb_handle_reply (EPlugin *ep, EMEventT
static void
bbdb_do_it (EBook *book, const char *name, const char *email)
{
- char *query_string;
+ char *query_string, *delim, *temp_name = NULL;
EBookQuery *query;
GList *contacts, *l;
EContact *contact;
-
gboolean status;
GError *error = NULL;
g_return_if_fail (book != NULL);
- if (name == NULL || email == NULL)
+ if (email == NULL || !strcmp (email, ""))
return;
- if (! strcmp (name, "") || ! strcmp (email, ""))
+ if ((delim = strchr (email, '@')) == NULL)
return;
- if (strchr (email, '@') == NULL)
- return;
+ /* don't miss the entry if the mail has only e-mail id and no name */
+ if (name == NULL || ! strcmp (name, "")) {
+ temp_name = g_strndup (email, delim - email);
+ name = temp_name;
+ }
/* If any contacts exists with this email address, don't do anything */
query_string = g_strdup_printf ("(contains \"email\" \"%s\")", email);
@@ -187,7 +189,8 @@ bbdb_do_it (EBook *book, const char *nam
for (l = contacts; l != NULL; l = l->next)
g_object_unref ((GObject *)l->data);
g_list_free (contacts);
-
+ g_free (temp_name);
+
return;
}
@@ -208,6 +211,7 @@ bbdb_do_it (EBook *book, const char *nam
for (l = contacts; l != NULL; l = l->next)
g_object_unref ((GObject *)l->data);
g_list_free (contacts);
+ g_free (temp_name);
return;
}
@@ -222,6 +226,7 @@ bbdb_do_it (EBook *book, const char *nam
g_object_unref ((GObject *)l->data);
g_list_free (contacts);
+ g_free (temp_name);
return;
}
@@ -229,6 +234,7 @@ bbdb_do_it (EBook *book, const char *nam
contact = e_contact_new ();
e_contact_set (contact, E_CONTACT_FULL_NAME, (gpointer) name);
add_email_to_contact (contact, email);
+ g_free (temp_name);
if (! e_book_add_contact (book, contact, &error)) {
g_warning ("bbdb: Failed to add new contact: %s\n", error->message);
Index: plugins/bbdb/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/bbdb/ChangeLog,v
retrieving revision 1.17
diff -u -p -r1.17 ChangeLog
--- plugins/bbdb/ChangeLog 28 Jul 2005 09:41:23 -0000 1.17
+++ plugins/bbdb/ChangeLog 13 Sep 2005 11:15:11 -0000
@@ -1,3 +1,9 @@
+2005-09-13 Sushma Rai <rsushma novell com>
+
+ * bbdb.c (bbdb_do_it): If the contact has only e-mail id and not name,
+ extract the name from e-mail id and add it to the address book.
+ Fixes #303286.
+
2005-07-28 Vivek Jain <jvivek novell com>
* bbdb.c:(bbdb_handle_reply):check for NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]