Article View: news.software.nntp
Article #19409Filtering message body (was Re: Posting sux!! so does INN)
From: Jeff Garzik
Date: Sat, 19 Jul 1997 00:00
Date: Sat, 19 Jul 1997 00:00
92 lines
3548 bytes
3548 bytes
This is a multi-part message in MIME format.
--------------7A00B2704EE9D3FC423DF9B5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
(cc'd to author)
Ian Stirling wrote:
> Justin M. Streiner <streiner@remove-to-mail-me.sgi.net> wrote:
> : Thanks for that insightful comment - I'm sure that can be worked into future
> : releases of INN :-)
> Can anyone think of a reason not to drop silently posts with no body?
heh. Here's patch to INN 1.5.1 that will make the message body
accessible to the Perl filter. To drop no-body messages, you would just
need to amend the Perl filter to include
"Blank message rejected" if ($hdr{"__BODY__"} = /^\s*$/m);
--
Jeff Garzik Quality news feeds
News Administrator INN Technical info, Consulting
Spinne, Inc. http://www.spinne.com/usenet/
--------------7A00B2704EE9D3FC423DF9B5
Content-Type: text/plain; charset=us-ascii; name="perl-filter-body.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="perl-filter-body.patch"
diff --context -r ../inn-1.5.1/innd/art.c innd/art.c
*** ../inn-1.5.1/innd/art.c Tue Dec 17 09:40:40 1996
--- innd/art.c Fri Jul 18 23:58:36 1997
***************
*** 1794,1800 ****
#if defined(DO_PERL)
pathForPerl = HeaderFind(article->Data, "Path", 4) ;
! if ((perlrc = (char *)HandleArticle()) != NULL) {
(void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, perlrc);
syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff);
ARTlog(&Data, ART_REJECT, buff);
--- 1794,1800 ----
#if defined(DO_PERL)
pathForPerl = HeaderFind(article->Data, "Path", 4) ;
! if ((perlrc = (char *)HandleArticle(Data.Body)) != NULL) {
(void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, perlrc);
syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff);
ARTlog(&Data, ART_REJECT, buff);
diff --context -r ../inn-1.5.1/innd/perl.c innd/perl.c
*** ../inn-1.5.1/innd/perl.c Tue Dec 17 09:40:40 1996
--- innd/perl.c Sat Jul 19 00:01:37 1997
***************
*** 34,40 ****
extern char *pathForPerl ;
char *
! HandleArticle()
{
dSP;
ARTHEADER *hp;
--- 34,41 ----
extern char *pathForPerl ;
char *
! HandleArticle(artBody)
! char *artBody;
{
dSP;
ARTHEADER *hp;
***************
*** 53,58 ****
--- 54,63 ----
if (hp->Found && hp->Value && strcmp (hp->Name,"Path") != 0)
hv_store(hdr, (char *) hp->Name, strlen(hp->Name), newSVpv(hp->Value, 0), 0);
}
+
+ /* store article body */
+ if (artBody != NULL)
+ hv_store(hdr, (char *) "__BODY__", 4, newSVpv(artBody, 0), 0) ;
if (pathForPerl != NULL)
{
--------------7A00B2704EE9D3FC423DF9B5--
Technical Details
Message-ID:
<33D1597E.6F89575E@spinne.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<33d0477a.8926553@code.ripco.com> <slrn5t1oii.nml.streiner@lurch.bv.sgi.net> <000033D150E0.NO_UCE@mauve.demon.co.uk>Show Full Headers
Complete Article Headers
Message-ID: <33D1597E.6F89575E@spinne.com> Subject: Filtering message body (was Re: Posting sux!! so does INN) Date: Sat, 19 Jul 1997 00:00:00 +0000 From: Jeff Garzik <jeff.garzik@spinne.com> References: <33d0477a.8926553@code.ripco.com> <slrn5t1oii.nml.streiner@lurch.bv.sgi.net> <000033D150E0.NO_UCE@mauve.demon.co.uk> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 257771669 To: Ian Stirling <000033D150E0.NO_UCE@mauve.demon.co.uk> Organization: Spinne http://spinne.com Newsgroups: news.software.nntp