🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
1 messages
1 total messages Started by Tom Christiansen Fri, 21 Apr 1995 00:00
Overquoting Solution (was: cannot post follow up with more quotes than new text? NewsXpress or NNTP?)
#16533
Author: 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);
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads