🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #162560

[slrn] Auto-prune threads started by trolls. A working script

#162560
From: Walter Dnes (delete the 'z' to g...
Date: Sun, 13 Feb 2005 07:09
102 lines
5503 bytes
On Sat, 12 Feb 2005 20:29:57 -0000, W. Citoan, <wcitoan@NOSPAM-yahoo.com> wrote:
>  Eh?  Even with a slow computer, that seems excessive.  I put together a
>  quick & dirty perl script here (Windows XP, 2.8 GHz Pent4, 768 MB RAM)
>  and it took less than a minute to go through 7300+ messages.

   Almost 5 and half year old (Sept 1999) Dell Dimension XPS T450)
machine here, 450 mhz PIII and 128 megs of RAM.  It's running Gentoo
linux, fully optimized.  I prefer email and news in text console mode.
My GUI is Blackbox, and it's reasonably snappy.  I tried KDE and GNOME...
once.  You don't want to hear about their (lack of) speed.  They're
faithful imitations of XP when it comes to bloated resource-hogging
eye-candy.

>  I actually had a full-featured perl script that did this on a
>  previous computer (slower, running Debian) and never saw a
>  performance problem.

   Hmmm.  I used a bash script, ed, grep, etc.

> >  To make a long story short, my approach is to scan all articles and
> >  insert the X-header "X-Bozomatic-Branch-Filter: yes" (without the
> >  quotes) as the first line in the article file of unwanted posts.
>
>  I don't recommend that.  That will cause slrn to have to do expensive
>  scoring.  Rather, extract the message id from the bozo's posts and add
>  those to your slrn score file.  That will kill the bozo and responses
>  to the bozo.

   Duhh.  I hate it when I miss the obvious.  Thanks for the tip.

[...a few hours later...]

   It woiks!!!  Under 2 minutes for the revised script to sail through
7000+ articles.  I cd to the spooldir of the group in question and
execute...

~/bozomatic/bozomatic

Here is the script, quoted to prevent linewrap...

> #!/bin/bash
> scriptdir="/home/waltdnes/bozomatic"
> bozo_file="${scriptdir}/killthrd.txt"
> killfile="${HOME}/News/message_ids.txt"
> newsgroup=`pwd | tr / . | sed "s/.*slrnpull.news.//"`
> echo "[${newsgroup}]" >  ${killfile}
> echo 'Score:: =-9999' >> ${killfile}
> for article in [0-9]*
> do
>   if (head --lines=20 ${article} | grep -i --quiet --file=${bozo_file}); then
>     message_id_line=`grep -i "^Message-ID: " ${article} | head --lines=1`
>     substring_length=$(( ${#message_id_line} - 14 ))
>     message_id=${message_id_line:13:${substring_length}}
>     echo "References: ${message_id}" >> ${killfile}
>   fi
> done

  Notes;
  - You need to run this script if slrnpull (or leafnode, or whatever)
    has pulled any new articles since the last time you ran it.

  - This script only works if you store the articles locally on your
    machine.

  - This script will not work in standard cshell, because it uses
    substrings of variables.  I'm familiar with bash.  zsh probably
    works as well, although I haven't tested it.  Regardless of which
    shell you normally use, this script will automatically run bash if
    it's available.

  - This script only takes care of followups to the troll and all
    subthreads from there on.  To block the troll's post that starts the
    (sub)thread you still need a regular entry in your scorefile.

  - The entries in killthrd.txt must follow standard regexp rules for
    entries in grep string files, not the looser rules used in slrn
    killfiles.  I do set grep to ignore case, but that's the only slack
    you get.

  - My ~/News/Score has the following line at the end...
    include message_ids.txt

  - ~/News/message_ids.txt *MUST* exist, otherwise slrn will not run.
    "touch ~/News/message_ids.txt" creates a zero-length file, which is
    sufficient.  You can put that command into whatever script you use
    to launch slrn, if you prefer.

  - When an article by a troll is expired, existing replies remain
    "read".  If someone (who isn't killfiled) replies after the troll's
    post expires from your local spool, that reply will not be filtered.
    That is not going to happen very often.

  killthrd.txt (i.e. ${bozo_file}) is the list of regexps (one per line)
that cause subthreads to be chopped.  Right now there's only one name in
there, and he appears to have been kicked off his ISP, but it was useful
for testing.  The list of message IDs sent by the bozo is saved in
message_ids.txt.

-- 
Walter Dnes; my email address is *ALMOST* like wzaltdnes@waltdnes.org
Delete the "z" to get my real address.  If that gets blocked, follow
the instructions at the end of the 550 message.
Technical Details
Message-ID: <378cojF58fkusU1@individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ams.giganews.com!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news1.uni-leipzig.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <37738kF5ahg8rU1@individual.net> <slrnd0spq2.3b8.wcitoan@wcitoan-via.supernews.com>

Show Full Headers
Complete Article Headers
Message-ID: <378cojF58fkusU1@individual.net>
Subject: [slrn] Auto-prune threads started by trolls. A working script
Date: Sun, 13 Feb 2005 07:09:07 +0000
From: "Walter Dnes (delete the 'z' to get my real address)" <wzaltdnes@waltdnes.org>
References: <37738kF5ahg8rU1@individual.net> <slrnd0spq2.3b8.wcitoan@wcitoan-via.supernews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.ams.giganews.com!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news1.uni-leipzig.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 102
Reply-To: see_my_sig_at_bottom_of_message@waltdnes.org
X-Trace: individual.net 4bydMvNMAeBVUDRFk37l+ge8qaUZ8qf0P2BpHKH0Iv/Tuz3P9/
User-Agent: slrn/0.9.8.1 (Linux)