Article View: news.software.readers
Article #60642Re: tin: How to CC an article to someone?
From: Sylvan Butler
Date: Mon, 17 Apr 2000 00:00
Date: Mon, 17 Apr 2000 00:00
211 lines
7502 bytes
7502 bytes
On 15 Apr 2000 01:12:21 GMT, Urs Jan๏ฟฝen <urs@buil.tin.org> wrote:
>In <slrn48fdufc.ee6h.hezu@tuuri.ling.helsinki.fi>,
> Heikki Kantola <hezu@iki.fi> wrote:
>> If I'm not mistaken, Tin doesn't support such option unlike as Tin
>> developers think that such behaviour should be discouraged.
>
>right
Sounds like this script is still needed. I call it 'tincc'. It has its
limits, but overall can work fairly well.
I think the comments give the history, but in short I took the work of
others and munged (e.g. made more complex) a bit. Some things to set
are at the first of the script before the big 'history' comment. It's
been a long time since I used it, so I really don't remember too much...
I took Sandy's lead and switched to slrn. :)
I think usage is documented... The essence is that you configure tin to
call this script on the editor command line, and pass the old command to
this script as parameters.
( e.g. change "vi +n fspec" to "tincc vi +n fspec" instead )
sdb
---------------- cut here ------------------
#!/bin/sh
# the owner
owner="your@address.dom"
CCowner=0
# a grep search string to match the groups for No Munging
NoMungeGroups="\(^local\.\)\|\(^safe\)"
cat > /dev/null <<'-----EndOfComment-----'
tincc
History
-------
Originally written by Scott Hagie (hagie at netcom dot com)
Customized by pedwards for his own use.
[961216 sandy at herring dot org (Sandy Herring)] - Changed for Solaris
use 'cut' rather than 'colrm'
change logic for choice test to send mail for response of y, Y or null
17Feb97 sylvan
integrated Sandy's documention into this comment block
changed 'echo ' commands to work with (ba)sh on linux
added automatic Cc to $owner (if defined)
added just copy to $owner if cc line is only two blanks or equals $owner
added 'From: $owner' header line to mail messages
16Apr97 sylvan
add 'reply-to' or other header(s)?
02Jun97 sylvan
clean up a bit, reformat 'Do you wanna' prompt
03Jul97 sylvan
if owner==cc then don't send owner extra copy!
21Aug97 sylvan
detect "no munge" groups and put reply-to instead of x-headers, etc.
added count of added lines to the offset in the editor command line
added 'Mail-Copies-To:' header
08Sep97 sylvan
change 'count of added lines' to actually count header lines
10Sep97 sylvan
prevent adding extra headers if already added
15Sep97 sylvan
option to not Cc $owner
16Sep97 sylvan
remove 'Mail-Copies-To:' header from mailed copy
23Sep97 sylvan
fix mess with .letter's
ToDo:
do BCC processing?
Usage:
* Put this script in a directory that is in your path and make
certain it's executable.
* Change the line in your tinrc that reads:
default_editor_format=%E +%N %F
to read instead:
default_editor_format=tincc %E +%N %F
...assuming you've called the script you cut and saved 'tincc'.
* Now you're ready for the BIG TEST. Follow up to a
posting and insert 'Cc: towhom@it.may.concern.edu' in
the header. After you're finished composing your
follow-up and file it, the script will run and if there
is a 'Cc: ' line present, ask you if you want to Cc the
article to towhom@it.may.concern.edu, the default
response being yepuhuhireallydo. After you reply to
that, you get the normal tin dialog to actually post
the article. If you decide to quit, well... too late to
stop the email you Cc'd youknowwho@thereitgoes.gov!
I've switched to slrn, which has that capability (and much more) built in.
cheers,
Sandy
-----EndOfComment-----
# variables
Article="$HOME/.article"
TmpArticle="$HOME/.article.tincc"
if [ -z "$owner" -a $CCowner -ne 0 ] ; then CCowner=0 ; fi
# look for reference to .article
if (echo $* | grep -s $Article) ; then
# all the good stuff
# look for reference to .article
msg=`sed '/^$/,$d' $Article | egrep -i '^Mail-Copies-To: '`
if [ -z "$msg" ] ; then
if (echo $* | grep -s $Article) ; then
> $TmpArticle
msg=`sed '/^$/,$d' $Article | egrep -i '^newsgroups: ' | cut -c 13-`
if [ -n "$NoMungeGroups" ] && (echo $msg | grep -s "$NoMungeGroups") ; then
echo "Reply-To: $owner" >> $TmpArticle
else
cat $HOME/.tin/x-headers >> $TmpArticle
fi
echo "Mail-Copies-To: never" >> $TmpArticle
cat $Article >> $TmpArticle
mv -f $TmpArticle $Article
fi
fi
# grab the offset for the first line to edit
msg=`echo "$*" | awk \
'{match($0,/\+[[:digit:]]+/);print substr($0,RSTART+1,RLENGTH-1)}'`
# edit it
if [ -n "$msg" ] ; then
Headers=`awk '(length($0) <= 1) {print NR+1;exit}' < $Article`
msg=`echo "$*" | sed -e "s/\+$msg/\+$Headers/g"`
$msg
else
$*
fi
msg=`sed '/^$/,$d' $Article | egrep -i '^cc: ' | cut -c 5-`
if [ -n "$msg" ] ; then # if cc
if [ "$msg" = " " ] ; then $msg="$owner" ; fi
echo -ne "Do you want to Cc article to '$msg'"
if [ $CCowner -ne 0 -a "$msg" != "$owner" ] ; then
echo -ne "\n and '$owner'"
fi
echo -ne " (Y/n)? "
read choice
if [ "$choice" = "y" -o "$choice" = "Y" -o -z "$choice" ] ; then
echo -ne "mailing Cc of article"
echo "From: $owner" > $TmpArticle
# breaks, esp. continued lines: -e '/^[Xx]-.\+: .\+$/d' \
sed \
-e '/^[Ff]rom: /d' \
-e '/^Mail-Copies-To: /d' \
-e 's/^[Nn]ewsgroups: /Posted-To: /' \
$Article >> $TmpArticle
if [ "$msg" != "$owner" -o $CCowner -eq 0 ] ; then
echo -ne " to '$msg'"
/usr/lib/sendmail -oi -t < $TmpArticle
fi
if [ $CCowner -ne 0 ] ; then
echo -ne " to '$owner'"
/usr/lib/sendmail -oi $owner < $TmpArticle
fi
sed '/^[Cc]c: /d' $Article > $TmpArticle
mv -f $TmpArticle $Article
fi
fi # if cc
msg=`sed '/^$/,$d' $Article | egrep -i '^newsgroups: ' | cut -c 13-`
echo ; echo ; echo "Prep'ed for sending to: $msg"
sleep 1
else # not $Article
$*
fi
---------------- cut here ------------------
--
| Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
| Watch out for my e-mail address. Thank UCE. #### change ^ to @ #### |
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
"Don't Tread On Me!"
Technical Details
Message-ID:
<slrn8fml7j.qkp.nospam+_no_Zs__0004@hpb13799z.zboi.hpz.com.invalid>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<8d697g$ii7$1@agate.berkeley.edu> <slrn48fdufc.ee6h.hezu@tuuri.ling.helsinki.fi> <8d8fll$mvt$4@news.hamburg.pop.de>Show Full Headers
Complete Article Headers
Message-ID: <slrn8fml7j.qkp.nospam+_no_Zs__0004@hpb13799z.zboi.hpz.com.invalid> Subject: Re: tin: How to CC an article to someone? Date: Mon, 17 Apr 2000 00:00:00 +0000 From: nospam+_no_Zs__0004@hpb13799z.zboi.hpz.com.invalid (Sylvan Butler) References: <8d697g$ii7$1@agate.berkeley.edu> <slrn48fdufc.ee6h.hezu@tuuri.ling.helsinki.fi> <8d8fll$mvt$4@news.hamburg.pop.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 612335682 Content-Transfer-Encoding: 8bit X-Original-NNTP-Posting-Host: hpb13799.boi.hp.com Mail-Copies-To: never Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.boi.hp.com X-Trace: hpbs1500.boi.hp.com 955996341 1050 15.98.137.41 (17 Apr 2000 18:32:21 GMT) Organization: Hewlett-Packard User-Agent: slrn/0.9.5.7 (Linux) Mime-Version: 1.0 NNTP-Posting-Date: 17 Apr 2000 18:32:21 GMT Newsgroups: news.software.readers