On 2000-01-31 15:04:32 +0100, Martin Keseg - Sun Slovakia - SE wrote:

> I tryed Svens solution:
>  set  mail_editor_command "mutt -H '%s' ; exit 1"
> but this does not work perfect.

I'm using the attached slrn macro file, plus the attached shell
script wrapper.

Note that this solution requires formail (1) from the procmail
package.  Improvements are welcome.

-- 
http://www.guug.de/~roessler/
%
% replacement forward and reply functions for slrn.
% these will drop you to your normal mail user agent.
%

variable mua_script="/home/roessler/bin/slrn-mua";

define my_reply_to_article ()
{
  pipe_article (Sprintf ("%s -reply", mua_script, 1));
}

define my_forward_article ()
{
  pipe_article (Sprintf ("%s -forward", mua_script, 1));
}

definekey ("my_reply_to_article", "r", "article");
definekey ("my_forward_article", "F", "article");
#!/bin/sh --

#
# A small script which is used to reply to or forward an
# article from within slrn.
#
# The article is expected to come on stdin, while $1 is either
# -reply or -forward.
#

# where is mutt located?
MUTT=/usr/local/bin/mutt

# where is formail?
FORMAIL=/usr/bin/formail

TMPDIR=${TMPDIR-/tmp}/`basename $0`.$$
mkdir -m 0700 $TMPDIR || { echo "can't create $TMPDIR!" >& 2 ; exit ; }

trap "rm -rf $TMPDIR; trap '' 0; exit" 0 1 2 3 4

cat > $TMPDIR/article

# get various headers

SUBJECT="`formail -z -x Subject: < $TMPDIR/article`"
DATE="`formail -z -x Date: < $TMPDIR/article`"
FROM="`formail -z -x From: < $TMPDIR/article`"
REPLY_TO="`formail -z -x Reply-To: < $TMPDIR/article`"
MESSAGE_ID="`formail -z -x Message-ID: < $TMPDIR/article`"
REFERENCES="`formail -z -x References: < $TMPDIR/article`"

exec > $TMPDIR/template

#
# functions
#

prepare_reply () {
        if [ -n "$REPLY_TO" ] ; then
                echo "To: $REPLY_TO"
        else
                echo "To: $FROM"
        fi
        
        if [ -n "$MESSAGE_ID" ] ; then
                echo "In-Reply-To: $MESSAGE_ID"
                echo "References: $REFERENCES $MESSAGE_ID"
        fi

        echo -n "Subject: "
        
        if [ -z "$SUBJECT" ] ; then
                echo "Re: your mail"
        else
                echo -n "Re: "
                echo "$SUBJECT" | sed -e 's/^Re: *//'
        fi

        echo

        echo "On $DATE, $FROM wrote:" | fmt

        sed -e 's/^/> /' $TMPDIR/article
}

prepare_forward () {
        echo "Subject: Fwd: $SUBJECT" 
        echo
        echo "----- Forwarded message -----"
        cat $TMPDIR/article
        echo
        echo "---- End forwarded message-----"
}

#
# main
#


case "$1" in
        -reply) 
                prepare_reply
                ;;
        -forward)
                prepare_forward
                ;;
        *)
                echo "usage: `basename $0` {-reply|-forward}" >& 2
                exit 1
                ;;
esac

exec > /dev/tty

$MUTT -H $TMPDIR/template < /dev/tty

Reply via email to