diff options
author | Sushma Rai <rsushma@src.gnome.org> | 2005-09-28 16:54:35 +0800 |
---|---|---|
committer | Sushma Rai <rsushma@src.gnome.org> | 2005-09-28 16:54:35 +0800 |
commit | 4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc (patch) | |
tree | f8d547f144f9f95ec41f84c1c8bd8743c1f909cf /plugins/bbdb | |
parent | a19d9df3e60438d5751e02f8c7aa54c5fe1a64c5 (diff) | |
download | gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar.gz gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar.bz2 gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar.lz gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar.xz gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.tar.zst gsoc2013-evolution-4276d74d2713f8b835bc7db8e0e9f92b7e10fdbc.zip |
Not skipping the entries which have only e-mail id and not name.
Fixes #303286.
svn path=/trunk/; revision=30387
Diffstat (limited to 'plugins/bbdb')
-rw-r--r-- | plugins/bbdb/ChangeLog | 6 | ||||
-rw-r--r-- | plugins/bbdb/bbdb.c | 20 |
2 files changed, 19 insertions, 7 deletions
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog index 5def505a3e..b167ba281c 100644 --- a/plugins/bbdb/ChangeLog +++ b/plugins/bbdb/ChangeLog @@ -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 diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 7ac34375f6..0021d81f21 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -156,24 +156,26 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) 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 *name, const char *email) 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 *name, const char *email) 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 *name, const char *email) 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 *name, const char *email) 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); |