OK, I'm fairly certain that this should be possible, but
for some reason I can't figure out how to do it; any advice would be
appreciated.  What I'm trying to do is implement the following logic:

If I'm in either folder =inbox or folder =pending
  and if I'm not replying to a message
     my_hdr From: string_a
  else if I'm replying to a message
     and if the message to which I'm replying doesn't have me as a recipient
        my_hdr From: string_b
     else
        reverse_name
else if in any other folder
   my_hdr From: string_a

        What I came up with is:

folder-hook . my_hdr From: string_a
folder-hook . set reverse_name 
folder-hook . unset reverse_realname
folder-hook (=inbox|=pending) send-hook '(~x .|~h In-Reply-To)' unmy_hdr From
folder-hook (=inbox|=pending) send-hook '~f sweth@' my_hdr From: string_b

        , which should set the From: header for all folders, but
then, if I'm in folders =inbox or =pending and replying (I figure presence
of References or In-Reply-To headers are a good sign of that) unset that
header (which in turn should allow reverse_name to work), but then also
reset that From: header to string_b if there was no address for
reverse_name to use.  (sweth@ begins the address that mutt gives me if I
don't have any options set.)

        Instead, however, everything is being set to string_a.  
The '~x .' and '~h In-Reply-To' patterns, if used separately, also fail
to work in the send-hook, but if I start the message, postpone it, and
then go into the postponed-message folder and search using those same
patterns, they both find the reply to which I would want them to apply.
similarly, if I try the ~f pattern in the postponed-message folder, that
also matches correctly (if I remove the original my_hdr before composing
the reply).

        This leads me to believe that send-hook is applied before
the full message is built, and more specifically before the headers
against which I'm matching are available (or maybe only certain headers
are passed in to the hook).  Is that the case?  The docs vaguely imply
that it is, by saying that send-hook is used to match recipients, but
they also say that the description of patterns in "Message Matching in
Hooks" applies, and that description explicitly references other headers
like "From:".

        Is that the problem?  If so, is there any way to accomplish
what I want?

        TIA,

        Sweth.

-- 
Sweth Chandramouli      Idiopathic Systems Consulting
[EMAIL PROTECTED]      http://www.idiopathic.net/

Reply via email to