Sunday, May 2, 2010

Introducing goocaa, or on the way to my perfect mutt setup

I've already posted a guide how I configured mutt over gmail to leverage some of gmail useful things, esp. address completion. I've used goobook for query_command. However, I don't quite like its stability, the way of its configuration and generally I prefer to avoid using software written in Python (or Ruby or any interpreted language) on my workstations.

So I wrote a small tool called goocaa (click on the link to check its github page). It's written in C and uses libxml2, glib2 and neon.

It uses ~/.goocaarc configuration file and its schema looks this way:


[default]
email = me@gmail.com
passwd = lalala


To start using it, just add:

set query_command = "/usr/local/bin/goocaa %s"

to ~/.muttrc [1].

One more thing that I've implemented is multi-account support. I have my work mail hosted at google also, so I forward it to my gmail account and put to a separate mailbox. For this mailbox I apply special rules, like, set "mail from" to work address, etc. One more thing that makes sense to do is to search in work's contacts instead of gmail ones. It could be done with goocaa's multi-account support. First, add additional profile to ~/.goocaarc:


[default]
email = me@gmail.com
passwd = lalala

[mywork]
email = me@mywork.com
passwd = tatata


And now use folder hooks in ~/.muttrc:


folder-hook . 'set from = "me@gmail.com"; \
set query_command = "/usr/local/bin/goocaa -p default %s"

folder-hook mywork 'set from = "me@mywork.com"; \
set query_command = "/usr/local/bin/goocaa -p mywork %s"


All done! Now mutt will use your gmail contacts everywhere except 'mywork' folder where it will be using your work contacts.

1: documentation on mutt's $query_command

No comments:

Post a Comment