purebred-mua / purebred

A terminal based mail user agent based on notmuch
GNU Affero General Public License v3.0
139 stars 19 forks source link

Allow to expand receipients from addressbook #499

Closed romanofski closed 1 year ago

romanofski commented 1 year ago

This implements an addressbook API and a way to expand addresses based on addressbook entries. The default retriever is based on the Mutt alias file using nick names.

The retrieval of Mutt aliases is not enabled by default, due to the fact that we need to use an absolute path to the alias file. Guessworking the possible location of the file goes against the current nature of being very explicit in the configuration.

Fixes https://github.com/purebred-mua/purebred/issues/17

romanofski commented 1 year ago

Btw. I already had a listing view implemented to browse the addresses, but removed it in this patch because it made the patch bigger than it should be. Thought it's probably better to put that as a separate optimization for addresses.

frasertweedale commented 1 year ago

@romanofski looking good mate. Gonna reach out to see if we can find a time to pair to discuss one more change.

romanofski commented 1 year ago

Just noticed that this is b0rked somewhat. Works "well" if all you do is just retrieve a single address, but if you need a few more you're in trouble since it replaces the entire line. Will definitely have to fix that.

Also needs to be registered for the action when we forward mail and probably the CC and BCC fields.

romanofski commented 1 year ago

Alright updated. This should do now. I parse out the addresses, grab the tail after the comma, search with that and concat the list of addresses before rendering. Removes garbage and seem to expand properly. I'd be interested in how it works for you and if you notice odd behaviour.