After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 545106 - [Automatic Contacts] Adds duplicates email addresses
[Automatic Contacts] Adds duplicates email addresses
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Plugins
2.26.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-plugin-maintainers
Evolution QA team
: 340390 473867 569808 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-07-28 08:56 UTC by Gil Forcada
Modified: 2014-03-24 16:24 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Proposed patch (5.50 KB, patch)
2014-03-15 21:33 UTC, Watson Yuuma Sato
reviewed Details | Review
Proposed patch (9.85 KB, patch)
2014-03-19 04:59 UTC, Watson Yuuma Sato
committed Details | Review

Description Gil Forcada 2008-07-28 08:56:20 UTC
This plugin is REALLY useful and comes in handy so many times.

I don't know how to reproduce always, but I send lots of emails to the same person every workday and I keep getting more and more choices for the same e-mail each time I send a mail.

I always fill the "To:" form typing some letters and when the drop-down list pops-down I go with the cursors/keyboard to the desired email account, hit return and then compose the mail.

It's an Ubuntu Hardy (8.04), don't know if it helps.

Also, I didn't find any bug related to this, so I'm hoping that isn't filled already with some weirdo name :)
Comment 1 Kandepu Prasad 2008-07-30 08:46:54 UTC
If I'm not wrong, the contact will be listed in the drop-down the number of times it matches with number of address books which has this contact. So if you do not want this to happen then pro'ly you might want to delete this contact in all other address books leaving the one which requires. Does this suffice your requirement? If so you can close this bug, else you can suggest for any improvement in this feature. Thanks.
Comment 2 Gil Forcada 2008-08-04 13:44:44 UTC
Sorry for the delay,

I only have one address book. So that's not the problem.
Comment 3 Akhil Laddha 2009-01-30 13:17:44 UTC
*** Bug 569808 has been marked as a duplicate of this bug. ***
Comment 4 Akhil Laddha 2009-12-22 04:18:02 UTC
*** Bug 473867 has been marked as a duplicate of this bug. ***
Comment 5 Nick Jenkins 2011-03-29 11:39:34 UTC
In Evolution 2.30.3 I am seeing something that sounds like the same bug, so I will describe what's happening here:

== Preferences ==
* Under Edit -> Preferences -> Mail Preferences -> Automatic contacts -> I have "create address book entries when sending mails" ticked, and the address book set to "auto-generated".
* Under Edit -> Preferences -> Contacts, I have the auto-completion option enabled, and have 6 different address books enabled (one of these address books is "auto-generated", and let's assume another one is called "Personal").
* All the address books described above (the 6 including "auto-generated") are local address books. There is no LDAP/Exchange/etc involved.

== What happens ==
1) Say a have a contact for "Bob Johnson" with the email address of "bob@fake.com", in the "Personal" address book. This contact includes lots of other useful details, such as phone numbers, address, birthday, instant messaging, a picture, some notes, and so forth.
2) I compose an email to Bob, using auto-completion of his email address from the "Personal" address book, and I send that email.
3) Another new contact for Bob, with just his email address alone, will be added to the "auto-generated" address book.

== Why this is a problem ==
* Step 3 duplicates an existing contact. I already have Bob in an address book.
* This is no point in making an inferior duplicate of an already known contact. The contact in the "Personal" folder has much more detail.
* At some later point, I will have manually go through the auto-generated contacts, and delete contacts that are duplicates. Also at some point Bob may change email address, and now since there are two copies of the same information, it's easy to miss the auto-generated one, and the old invalid email address will still be suggested.
* Duplication is annoying :-)
* Duplication is annoying :-)
* I have seen the behavior described by the OP, where the same email address for the same person is suggested lots and lots of times. I just cleaned out my auto-generated address book to prevent this.

== What should happen ==
To prevent these problems:
* If the same email address is already used by a contact in an auto-completion address book, then do not add a new contact to the auto-generated contact list.
* This will prevent duplicates from being created.
* The auto-generated address book should thereafter only get additions for new and unknown email addresses that are not already in any of the auto-completion address books.
Comment 6 André Klapper 2012-08-07 10:56:44 UTC
*** Bug 340390 has been marked as a duplicate of this bug. ***
Comment 7 Watson Yuuma Sato 2014-03-15 21:33:37 UTC
Created attachment 272036 [details] [review]
Proposed patch
Comment 8 Watson Yuuma Sato 2014-03-15 21:37:27 UTC
Proposed patch above walks through all addressbooks and searches for a matching contact. If not found, the contact is added as it used to be.

Please let me know if there is a better way to do it.
Comment 9 Milan Crha 2014-03-18 10:38:09 UTC
Review of attachment 272036 [details] [review]:

Thanks for the patch, I have nothing significant against it as it is, the mentioned things are mostly about coding style issues, and it is pretty minor. The "other approach" you mentioned is doable, as an enhancement of your current patch:
a) the bbdb plugin can safely skip autocompleted contacts from the composer; such contacts are recognized by non-NULL returned pointer from e_destination_get_contact()
b) there is still needed what you did, to check addressbooks, in cases where a user is too quick and writes an address which is already in the book, but he/she writes it quickly enough that the autocompletion will be slow and avoided. The enhancement of the patch will be to:
b1) check only books which are marked for autocompletion (e_source_autocomplete_get_include_me(), but make sure you'll not add this extension if it's not there)
b2) check only in enabled books (e_source_registry_list_enabled())

::: plugins/bbdb/bbdb.c
@@ +312,3 @@
+				client_cache, (ESource *) aux_addressbooks->data,
+				E_SOURCE_EXTENSION_ADDRESS_BOOK,
+				NULL, &error); //Treat error

a) coding style: no C++ comments, please
b) the 'error', if set, is leaked here, and/or reused inappropriately later in the code

@@ +322,3 @@
+			g_free (temp_name);
+			g_list_free_full (addressbooks, (GDestroyNotify) g_object_unref);
+			g_object_unref(client_addressbook);

coding style: missing space after 'g_object_unref' (this is there multiple times)

@@ +367,3 @@
+				g_warning (
+						"bbdb: Could not modify contact: %s\n",
+						error->message);

this needs better indentation, no need to go that far
Comment 10 Watson Yuuma Sato 2014-03-19 04:59:05 UTC
Created attachment 272355 [details] [review]
Proposed patch

Thanks for the feedback.
I have made the enhancements.
Comment 11 Milan Crha 2014-03-24 16:21:31 UTC
Review of attachment 272355 [details] [review]:

Looks good, just one coding style typo (in the use of e_source_registry_list_enabled) and, please, do not pile patches this way, rather create an updated patch which changes each soruce file only once the next time. Thanks in advance.
Comment 12 Milan Crha 2014-03-24 16:24:25 UTC
Created commit 7830511 in evo master (3.13.1+) [1]
Created commit a132c1f in evo evolution-3-12 (3.12.1+)

[1] https://git.gnome.org/browse/evolution/commit/?id=7830511