notmuch-addrlookup-c icon indicating copy to clipboard operation
notmuch-addrlookup-c copied to clipboard

Results are not filtered properly

Open mpldr opened this issue 3 years ago • 3 comments

What is returned:

$ notmuch-addrlookup robin
"Robin John"  <[email protected]>
<[email protected]> <<[email protected]>>

What I'd expect:

$ notmuch-addrlookup robin
"Robin John"  <[email protected]>

I am also not too sure on the double angle brackets around the mail is actually valid; it happens for some mails, but not all.

mpldr avatar Sep 07 '22 16:09 mpldr

Update: My email client (aerc) does not like the angle brackets; I have to grep -v them away

mpldr avatar Sep 08 '22 19:09 mpldr

Hmm, is the regex here at fault?

ferdinandyb avatar Sep 17 '22 21:09 ferdinandyb

I couldn't tell if my life depended on it. While I like reading & writing regexes, these have way to many backslashes in them.

My idea to solving this (while being not at all familiar with the codebase) is to trim the resultlist by checking if an email without a name is already present. A hashmap would come to mind, but my C skills are not nearly advanced enough to even attempt this.

Basically, everything not matching (.+) <([^ ]+)> should probably not be considered as an email address with a name attached. (angle brackets and spaces around "pure" addresses should still be removed though)

mpldr avatar Sep 18 '22 08:09 mpldr