lucc / khard

Console vcard client
https://khard.readthedocs.io/en/latest/
GNU General Public License v3.0
600 stars 65 forks source link

add-email: try looking up contact by email address #259

Closed jeffa5 closed 2 years ago

jeffa5 commented 4 years ago

When adding an email from raw email headers the lookup is currently by name or all if strict isn't set. This doesn't seem to search the email field though so with a contact of the form:

A <a@a.com> A last <a.last@b.com>

Where both contacts are the same person, even with those emails in the contact, it still says would I like to create a new contact for A last, when my stored contact name is just A.

lucc commented 4 years ago

I would be happy if the logic for finding the correct contact to add the email address could be improved. From your current description I do not fully understand the scenario. Can you provide some example email and contacts or address books and say what outcome you expect. Ideally you can also send a PR with some failing tests. But if you just want to provide the example I can also code the tests myself.

jeffa5 commented 4 years ago

I've created a test which should show this better here https://github.com/scheibler/khard/pull/261

lucc commented 4 years ago

Since releasing 0.17 with the new query syntax I have come back and thought about this several times. I always end up with the question: Why should I search for the email I am about to add. If I find it, it is already there so I don't need to add it. Can you give an example why this might be needed?

scheibler commented 2 years ago

I've extended the add-email functionality a while ago (see commit fdc441cf238c2759959f3ed5e626cb49684e5555 for details) Refer to the documentations scripting section for how to include additional email header fields.

Please try out the current develop branch and feel free to reopen this issue, if the add-email action still doesn't do what you want.