Hello Janek!

On Sat, 10 Jun 2000, Janek Richter wrote:

> i want to know if it is possible to read newsgroups in mutt.

AFAIK there is a patch for an older version of mutt, but I
prefer a solution which will use slrn in combination with
mutt (reply and forwarding). This was posted by Thomas Roessler 
<[EMAIL PROTECTED]> on the end of january 2000 on this list. 
It's using the attached slrn macro file, plus the attached shell
script wrapper.

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

Thank you very much, Thomas!! :-)))

-----------------------> cut here <------------------------ -
%
% 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

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

Enjoy it!

bye - Wilhelm

--  
Wilhelm Wienemann     __
                     / /    __  _  _  _  _ __  __       
 (°>   (o-          / /__  / / / \// //_// \ \/ /           -°)  -°) 
 //\  //\          /____/ /_/ /_/\/ /___/  /_/\_\           /\\   /\\
 V_/_ v_/_   # Enjoy Linux and the Power of Open Source #  _\_V  _\_V

Reply via email to