🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #16533

Overquoting Solution (was: cannot post follow up with more quotes than new text? NewsXpress or NNTP?)

#16533
From: Tom Christiansen
Date: Fri, 21 Apr 1995 00:00
68 lines
2958 bytes
Submitted-by: tchrist@mox.perl.com
Archive-name: check_fascistly_overquoted.pl

In news.software.readers, twpierce@midway.uchicago.edu (Tim Pierce) writes:
:>Solution?  Use a newsreader (like News Xpress) that lets you change the 
:>quote character(s).
:
:And that, of course, is the real problem with this
:heuristic.  Lazy and irresponsible users will always simply
:find a way around the checker, rather than learning to
:cooperate.

Oh, we can fix THAT -- just a Simple Matter of Programming (tm).

The following program can be called from a newsreader or newsposter
to verify that the guy isn't quoting too much.  If you're running 
from a shell script, then a simple

    if check_fascistly_overquoted $article; then
	: # everythings' fine
    else
	echo Try again, buckwheat.
	state=edit
    fi

The world is safe again, at least as soon as the nntp and inn 
and newsreader maintainers etc all put this code into their 
fine products.

I'm sure you're all *perfectly* thrilled. :-)

Have a nice day,

--tom


#!/usr/local/bin/perl5
# wants perl 5.0 or better
# check_fascistly_overquoted.pl, by tchrist@mox.perl.com
#
# OPTIONS: -v for verbose flag, -t NN to change tolerance percentage from 50%
# INPUT:   a news article
# OUTPUT:  if -v, then shows how much it found and where
# EXIT:	   1 (failure) if tolerance exceeded, 0 (success) otherwise

require 5.0;  

use Getopt::Std;
getopts("vt:") || die "usage: $0 [-v] [-t tolerance] [input_file]\n";

$VERBOSE   = $opt_v;
$TOLERANCE = $opt_t || 50; 

$/ = ''; <>;   # head header
while ( <> ) {
    last if eof && /^--/;
    if ($. == 2) { s/\A.*(<.*?>|\@).*?:\n//s }  # attribution
    s/\n+\Z/\n/;
    $total += tr/\n//;
    while (/(([^\w\s]+).*\n)(\2.*\n)+/g) {  # YANETUT
	$quoted_lines += $count = ($match_part = $&) =~ tr/\n//;
	print "$count lines quoted with $2\n" if $VERBOSE;
    } 
} 
$percent = $quoted_lines / $total * 100;
printf "$quoted_lines lines quoted out of $total: %d%%\n", 
    $percent if $VERBOSE;
exit ($percent > $TOLERANCE);
Technical Details
Message-ID: <3n9bbv$2v8@csnews.cs.colorado.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.sources.mbox.zip!not-for-mail
References: <3mh1rd$af5@tmpsu003.tmpprv.allied.com> <KARL.95Apr12134222@APHRODITE.NECTAR.CS.CMU.EDU> <3mj1pf$fk5@elmer.wrq.com> <D6zCEt.yM@midway.uchicago.edu>

Show Full Headers
Complete Article Headers
Message-ID: <3n9bbv$2v8@csnews.cs.colorado.edu>
Subject: Overquoting Solution (was: cannot post follow up with more quotes than new text? NewsXpress or NNTP?)
Date: Fri, 21 Apr 1995 00:00:00 +0000
From: Tom Christiansen <tchrist@mox.perl.com>
References: <3mh1rd$af5@tmpsu003.tmpprv.allied.com> <KARL.95Apr12134222@APHRODITE.NECTAR.CS.CMU.EDU> <3mj1pf$fk5@elmer.wrq.com> <D6zCEt.yM@midway.uchicago.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.sources.mbox.zip!not-for-mail
X-Deja-AN: 101352289
Followup-to: news.software.readers
Organization: Perl Consulting and Training
Reply-to: tchrist@mox.perl.com (Tom Christiansen)
Newsgroups: news.software.readers,alt.sources
Originator: tchrist@mox