<<< Date Index >>>     <<< Thread Index >>>

multiple accounts - my problem and a solution



Hi everyone,

I use mutt with multiple IMAP accounts by having something
like this in my .muttrc:

  macro index <F10> ":source ~/.mutt/account.1\nc!\n" "Load profile 1"
  macro index <F11> ":source ~/.mutt/account.2\nc!\n" "Load profile 2"
  macro index <F12> ":source ~/.mutt/account.3\nc!\n" "Load profile 3"

and this is what's going in the account.X files:

  set spoolfile="imaps://serverX:993/INBOX"
  set folder="imaps://serverX:993/mail"
  set from="accountX@domainX"
  set hostname="domainX"
  set imap_user="userX"
  set imap_pass="passX"
  set sendmail="/usr/bin/ssh userX@serverX /usr/sbin/sendmail -oem -oi"
  set postponed="+postponed"
  set record="+outbox"
  set status_format="-%r-Mutt(AccountX): ..."

(the rest of status_format is same as default)

Now this works almost perfectly, except in the case when I want to
change to a saved folder ('c' in index view) and press '?' to browse
the folders. It works the first time but does not work once I switch
profiles and go to a different server - it tries unsuccessfully to
connect to the folders dir in the previous account and fails miserably
when the user/pass don't match. I found that the reason is the 'LastDir'
(and possibly 'LastDirBackup') static variables in browser.c.

I have a solution (a patch is attached for 1.4.1, same patch also
works for 1.5.5.1) which I don't really like very much, but at least
it is simple and minimally intrusive. It is kind of a hack - when a
string variable is being set (a clue that somebody is reading/changing
configuration), I call a function _mutt_forget_lastdir() in browser.c.

I post this hack of mine here so that anybody who is using (or should I
say :-} abusing the flexibility of mutt for...) multiple accounts in a
way similar to mine can have a solution. I would also appreciate if the
person who is responsible/maintaining the respective code in browser.c
has a look at my patch and decide whether there is a better method of
solving this issue.

Cheers,
Varol Kaptan