Re: Mail reply or forward

Brian Salter-Duke <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <20080707000112.GA716@SALTERDUKE2>
On Mon, Jul 07, 2008 at 12:36:46AM +0100, Peter J Ross wrote:
> On Sunday 06 July 2008 10:50:52 Brian Salter-Duke wrote:
> 
> > I have been playing with "r" and "F" to reply to a poster by email or
> > forward a message by email. It brings up mutt OK. I have muutt specified
> > in .slrnrc. However, it gives some duplicate headers in the body of the
> > message (i.e after a blank line). Should this happen?
> 
> No, that shouldn't happen.
> 
> What are the relevant parts of your slrnrc? The standard advice for using slrn 
> with mutt is here:
> 
> <http://slrn.sourceforge.net/manual/slrn-manual-6.html#mail_editor_is_mua>
> 
> It would be easier to solve your problem if you specified the versions of slrn 
> and mutt that you're using. It's also possible that your editor configuration 
> is faulty.

I'll reply later to this when I've checked out everything.
 
> > I also played around with slrn-mua.sh which I had used about 7 years ago
> > on a different system - unix, I now use cygwin for mutt and slrn on a
> > laptop. Are there still any advantages in using that, compared with the
> > slrn support directly for reply and forward?
> 
> I've never heard of "slrn-mua.sh", and Google seems not to have heard of it 
> too. It sounds interesting.

I kept this from 2000. I tried to get it to work, but it did not get the
From: line correct.

--------------------------------------------------------------------------- 
> On Sat, Jun 10, 2000 at 07:36:50AM +0200, Wilhelm Wienemann muttered:

> This is wonderful, but I am a bit of a newbie when it comes to
> scripting and whatnot. Is the first part of this a patch?

No, it's a macro-file. On my box I've all my macros in the
$HOME/.slrn directory and here it is called .slrn-mua.sl
To load (interpret) it with my $HOME/.slrnrc file I have to
add a line like

interpret ".slrn/.slrn-mua.sl"

-----------------------> cut here <------------------------ -
%
% replacement forward and reply functions for slrn.
% these will drop you to your normal mail user agent.
%

variable mua_script="/usr/local/bin/slrn-mua.sh";

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", "m", "article");
definekey ("my_forward_article", "M", "article");
% 'r' and 'F' do not work, but continue to reply and forward with slrn
% anyway. 'm' and 'M' do work and are in current slrn setup.

---------------------------------------------------------

> How would I go about exectuing all of this...?

The following shell script wrapper is located as slrn-mua.sh 
in the directory /usr/local/bin/ 

-----------------------------------------------------------
#!/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/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

-----------------------> cut here <------------------------ -

Note: The Shell-script needs the executable permissions for
	  its users. This is usually done by a 'chmod -v 755 slrn-mua.sh'
	  as root in the destination directory. 

Now every time you use a 'r' to do a reply or a 'F' to do a
forwarding in slrn it will use 'mutt'.

Enjoy it! :-))

bye - Wilhelm

-- 
-- _ _          __  __ Wilhelm Wienemann <[email protected]>
| (_)_ __  _   _\ \/ /   -> For a better taste - Linux Inside
| | | '_ \| | | |\  /    -> Blue screens for Linux background only
| | | | | | |_| |/  \    -> Enjoy Linux and the Power of Open Source
|_|_|_| |_|\__,_/_/\_\ Registered-Linux-User: 70712 http://counter.li.org/

--------------------------------------------------------------------------- 

Thanks, Brian.

> > Keep up the good work. I had a time away from slrn. It is good to be
> > back.
> 
> Welcome back. slrn is enjoying a renascence. And there *is* going to be a 
> 0.9.9 release *very* soon, I hope.
> 
> -- 
> PJR :-)
> 
> Updated and experimental documentation for slrn 0.9.9 and beyond:
> <http://slrn-doc.sourceforge.net>
> 
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08

-- 
      Brian Salter-Duke          Melbourne, Australia
    My real address is b_duke(AT)bigpond(DOT)net(DOT)au
               Use this for reply or followup
Use slrn for all your news reading - "http://slrn.sourceforge.net/" 




-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.