[comp.mail.mush] using mush as the mailer

depeche@quiche.cs.mcgill.ca (Sam Alan EZUST) (09/27/89)

Is there any way to use MUSH as the mailer and the poster for news?
I am using rn on a sun running UNIX...

If i set mailer=mush whenever I do a reply it says "no mail for depeche".

-- 
 S. Alan Ezust aka "Depeche Modem"       depeche@calvin.cs.mcgill.ca
 McGill University Computer Science      Disclaimer: I claim everything!
 Montreal, Quebec, Canada                (je pense que.... ) je me souviens
       "This kind of pornography is a matter of artistic creativity"

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (09/29/89)

Do we need an "Intro to comp.mail.mush" with FAQ? :-)

In article <1476@quiche.cs.mcgill.ca> depeche@quiche.cs.mcgill.ca (Sam Alan EZUST) writes:
} 
} Is there any way to use MUSH as the mailer and the poster for news?
} I am using rn on a sun running UNIX...

Here comes the Rnmush script again.  Just use

    setenv MAILPOSTER "Rnmush -h"

or the /bin/sh equivalent

    MAILPOSTER="Rnmush -h; export MAILPOSTER.

This updated release of the script fixes a minor bug with temp file
creation and contains some (one?) hints for SysV conversion.  It still
can't be used for posting; I have a summary of the changes needed to
turn this into a script for posting, but it doesn't seem useful enough
to bother (and it would only work at sites with a sendmail-like MTA).

I might mention as a teaser that the next release of mush has its own
-h flag, so use of this script will become optional ....

#! /bin/sh -
# Rnmush -- script to use mush for Rnmail
#
# Based on Larry Wall's Rnmail
#
# syntax: Rnmush -h headerfile [oldart]		or
#         Rnmush destination-list 		or just
#         Rnmush
#
# This script creates two other scripts:
#  1) sh script, which takes care of merging the rn header file with
#	mush's editor temp file and then calls the regular visual editor;
#  2) mush script, fed via "mush -source", which sets up some environment
#	and arranges for the first script to be used as the visual editor.

# system configuration

# your organization name
orgname="/usr/lib/news/organization"

mush=mush
defeditor=/usr/ucb/vi
test=/bin/test
sed=sed
echo=echo
cat=cat
rm=/bin/rm
chmod=chmod

# how to echo without a newline
n="-n"
c=""

dotdir=${DOTDIR-${HOME-$LOGDIR}}
tmpart=$dotdir/.letter
start=$dotdir/.rnmush$$
preedit=$dotdir/.rnvis$$
locked=$dotdir/.rnvlk$$

# Remove traps of 21 22 23 for SysV
trap "$rm -f $start $preedit $locked; exit 1" 1 2 3 13 15 21 22 23

# some initialization for the mush script
visual=${VISUAL-${EDITOR-$defeditor}}
orgname=${ORGANIZATION-$orgname}
case $orgname in
/*) orgname=`$cat $orgname` ;;
esac
mailrecord=${MAILRECORD+record="${MAILRECORD}"}

# Use this line for mush 6.4
#$echo set verify autoedit $mailrecord \; unset edit_hdrs > $start
# Change to this line for mush 6.5
$echo set edit_hdrs verify autoedit $mailrecord > $start

headerfile=""
case $# in
0) ;;
*)  case $1 in
    -h)
	headerfile="$2"
	case $# in
	3) oldart=$3 ;;
	1) shift ;;
	esac
	;;
    esac
    ;;
esac

subject=""
case $headerfile in
'')
    case $# in
    0)
	$echo $n "To: $c"
	read to
	;;
    *)
	to="$*"
	;;
    esac
    $echo $n "Subject: $c"
    subject="-s `read subject; echo '\"'$subject'\"'`"
    $echo $n "$c" > $tmpart
    $echo my_hdr Organization: "$orgname" >> $start
    $cat <<EOStrip > $preedit
if $test ! -f $locked ; then
$cat $tmpart >> \$1
$echo "" > $locked
fi
$visual \$1
EOStrip
    ;;
*)
    # Handle wrapped To: lines
    to=`$sed -n -e '1,/^$/ {
			/^To:/,/^[A-Za-z]/ {
				s/^To: \(.*\)/\1/p
				/^[^A-Za-z]/p
			}
		}' < $headerfile | tr '\012' ' '`
# Use this section for mush 6.4
#    $echo unset ask asksub askcc >> $start
#    $sed '1,/^$/d' < $headerfile > $tmpart
#    subject="-s \"`$sed -e '/^Subject:/p' -e '/.*/d' < $headerfile \
#	| $sed 's/^Subject: //'`\""
#    $sed -e '1,/^$/p' -e '/.*/d' < $headerfile \
#	| $sed -e '/^To:/d' -e '/^Subject:/d' -e '/^$/d' -e 's/^/my_hdr /' \
#	>> $start
#    $cat <<EOStrip > $preedit
#if $test ! -f $locked ; then
#$cat < $tmpart > \$1
#$echo "" > $locked
#fi
#$visual \$1
#EOStrip
#
# Change to this new section for mush 6.5
#
    $echo $n "$c" > $tmpart
    $cat <<'EOStart' >> $start
if $?ask
    unset ask
endif
if $?asksub
    unset asksub
endif
if $?askcc
    unset askcc
endif
EOStart
#
# The code below relies on mush's placement of the To: and Subject:
# headers.  If Subject: does not immediately follow To:, this removes
# too many headers.   Alternate sed command if you have this problem:
#   $sed -e '/^To:/d' -e '/^Subject:/d' -e '/^\$/d' < \$1 > /tmp/$$
# (the alternate does not handle wrapped To: lines properly).
#
    $cat <<EOStrip > $preedit
if $test ! -f $locked ; then
$sed -e '/^To:/,/^Subject:/d' -e '/^\$/d' < \$1 > /tmp/$$
$cat /tmp/$$ $headerfile $tmpart > \$1
$rm -f /tmp/$$
$echo "" > $locked
fi
$visual \$1
EOStrip
# End of 6.5 section
    ;;
esac

$cat <<EOStart >> $start
set visual=$preedit
mail $subject $to
quit
EOStart

$chmod +x $preedit

file=h
while $test "$file" = h ; do
    $echo ""
    $echo $n "Prepared file to include [none]: $c"
    read file
    case $file in
    h)
	;;
    '')
	$echo "" >> $tmpart
	;;
    *)
	$cat $file >> $tmpart
	;;
    esac
done

$echo ""
$mush -shell -noheaders -readonly -source $start -folder /dev/null
$rm -f $preedit $start $locked
-- 
Bart Schaefer           "And if you believe that, you'll believe anything."
                                                            -- DangerMouse
CSNET / Internet                schaefer@cse.ogc.edu
UUCP                            ...{sequent,tektronix,verdix}!ogccse!schaefer