🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #865

Re: mailing lists -> newsgroups

#865
From: Kris Stephens [Hail Eris!]
Date: Wed, 19 Dec 1990 18:59
115 lines
3706 bytes
In article <MEYER.90Dec17124939@cambium.uoregon.edu> meyer@cambium.uoregon.edu (David M. Meyer) writes:
>	Does anyone have a script that they like for injecting
>	news from a mailing list (e.g., an alias) into a local
>	news group (i.e., that does the "right" thing with
>	headers, subject lines, etc)?
>
>	Thanks,
>	Dave

In its simplest form, all the program needs to do is strip the leading
'From ' header (without a colon) and feed it into inews -h...

--
# Replace "newslist" with the phantom username that's on the mailing list
# Replace "news.group" with the newsgroup name
aliases: (for sendmail)
	newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -n news.group"
aliases: (for smail)
	newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -f\"$SENDER\" -n news.group"
--

I tend to lean a little harder on it by stripping out a few other
headers, and thus use awk instead of sed.  If the awk script is in
/usr/lib/news...

--
# Replace "newslist" with the phantom username that's on the mailing list
# Replace "news.group" with the newsgroup name
aliases: (for sendmail)
	newslist:"|/bin/awk -f /usr/lib/news/mail2news.awk | /usr/lib/news/inews -h -n news.group"
aliases: (for smail)
	newslist:"|/bin/awk -f /usr/lib/news/mail2news.awk | /usr/lib/news/inews -h -f\"$SENDER\" -n news.group"
--

-- cut into mail2news.awk --
# %W% %G% %U%
#
# mail2news.awk -- a utility to handle the headers in a mailfile for
# posting as news
#
BEGIN {
	mysite = "your_uucp_node_name_here"     # Tailor this line!!
	nuke[1] = "[Tt][Oo]:"
	nuke[2] = "[Cc][Cc]:"
	nuke[3] = "[Bb][Cc][Cc]:"
	nuke[4] = "[Rr][Ee][Cc][Ee][Ii][Vv][Ee][Dd]"
	nuke[5] = "[Ss][Tt][Aa][Tt][Uu][Ss]:"
        nuke[6] = ".*[Mm][Aa][Ii][Ll][Ee][Rr]"
	nuke[7] = "[Dd][Aa][Tt][Ee]:"

	nukes     = 7

	cont_nuke = 0

	inheader  = 1  # Until we get a null line
	}

#
# Once we're out of the header, just print the lines
#
inheader == 0 {
	print
	next
	}

#
# End of header?
#
$0 == "" {
	inheader = 0
	print
	next
	}

#
# Delete mail's leading 'From ' header
#
NR == 1 && match($0, "[Ff][Rr][Oo][Mm] ") == 1 {
	print "Path:", mysite "!nobody"
	next
	}

#
# Continuation of a nuked header?
#
cont_nuke == 1 {
	first = substr($0, 1, 1)
	if ( first == " " || first == "\t" ) {
		next    # Skip it -- it's a continuation
		}
	cont_nuke = 0   # Otherwise, turn off cont_nuke flag
	}

#
# Lines to cut?
#
	{
	for ( i = 1; i <= nukes; i++ ) {
		if ( match($1, nuke[i]) == 1 ) {
			cont_nuke = 1   # Set cont_nuke flag for next line
			next            # Don't print this one
			}
		}
	print
	}
-- cut into mail2news.awk --


..Kris
-- 
Kristopher Stephens, | (408-746-6047) | krs@uts.amdahl.com | KC6DFS
Amdahl Corporation   |                |                    |
     [The opinions expressed above are mine, solely, and do not    ]
     [necessarily reflect the opinions or policies of Amdahl Corp. ]
Technical Details
Message-ID: <d4a=02WLf9wm01@amdahl.uts.amdahl.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!amdahl!krs
References: <MEYER.90Dec17124939@cambium.uoregon.edu>

Show Full Headers
Complete Article Headers
Message-ID: <d4a=02WLf9wm01@amdahl.uts.amdahl.com>
Subject: Re: mailing lists -> newsgroups
Date: Wed, 19 Dec 1990 18:59:06 +0000
From: krs@uts.amdahl.com (Kris Stephens [Hail Eris!])
References: <MEYER.90Dec17124939@cambium.uoregon.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utstat!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!amdahl!krs
Newsgroups: news.sysadmin,news.misc,news.software.nntp
Reply-To: krs@amdahl.uts.amdahl.com (Kris Stephens [Hail Eris!])
Distribution: news
Organization: Amdahl Corporation, Sunnyvale CA
Lines: 114