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

Re: simulating "Aborted unmodified message" condition



On 2006-09-11, William Yardley <mutt-users@xxxxxxxxxxxxxxxxx> wrote:
> On Mon, Sep 11, 2006 at 08:47:59PM -0700, Gary Johnson wrote:
> > On 2006-09-11, William Yardley <mutt-users@xxxxxxxxxxxxxxxxx> wrote:
> 
> > > So now my only problem is that the macro, which is like:
> > >  macro index M ":set editor=~/bin/mutt_mailman_approve.pl<enter> \
> > >   <view-attachments><last-entry><search-reverse>message/rfc822<enter> \
> > >   <reply><send-message>:set editor=\"vim +'/^$/+2'\"<enter><exit>"
> > > 
> > > doesn't work right if I abort the message, because editor never gets
> > > reset, and the rest of the macro is interpreted literally. Pretty sure
> > > there's no good workaround for this, though... 
>  
> > You're welcome.  I think you're right about the macro, though.  I
> > can't think of any workaround either.
> > 
> > Since you don't want mutt to really send the message, though, mightn't
> > it work to pipe the attachment to your script instead of attempting to
> > reply to it, maybe setting pipe_decode first?
> 
> I do, though - just only in cases where the user doesn't abort.
> 
> I don't know if you're familiar with Mailman's email based moderation -
> basically, you respond to an attached rfc822 messaqge with a
> confirmation string... if you reply without an "Approved: " header, it
> deletes the held message; if you reply with "Approved: password" in the
> headers or first line of the body, it approves it.
> 
> I guess I could see if sending "Approved: boguspasswd" will work for the
> third case - it's been a while, but I seem to remember that sending a
> bogus password might just kill the message, though.

Here's a thought:  how about using message-hooks or reply-hooks to 
set the editor?  Something like this:

    message-hook . "set editor=\"vim +'/^$/+2'\""
    message-hook <pattern in moderated mail> "set 
editor=~/bin/mutt_mailman_approve.pl" 

The key idea is to use a hook to reset 'editor' since your macro 
can't.  I'm not sure what options are available for setting 'editor' 
to mutt_mailman_approve.pl; if the hook fires early enough--e.g., 
when you enter the view-attachments menu--you might still be able to 
set it to mutt_mailman_approve with a macro and therefor still have 
the option of using the normal editor on the message.

Gary

-- 
Gary Johnson                               | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx                   | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA