🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #234870

Re: [slrn] turbo-plonk.sl improved (Was: Can I make a rule that will auto-ignore all follow-ups to a certain author?)

#234870
From: John E. Davis
Date: Fri, 31 Jul 2009 17:15
71 lines
3363 bytes
On Sat, 01 Aug 2009 00:16:22 +1000, Troy Piggins <usenet-0907@piggo.com>
wrote:
> Let's pick -666 as the score.  Upon entering a group, any article
> with a score of -666 will automatically cause any articles with
> it's Message-ID in their References to be killfiled.
[...]

Here is a version that deals directly with the scorefile and should be
a bit faster.  --John

#v+
private variable Scorefile_Score = -666;
private variable Subthread_Score = -9998;
private variable Subthread_Expires = 21;
private define auto_kill_fups ()
{
   if (is_group_mode ())
     error (_function_name () + " doesn't work in group mode!");

   uncollapse_threads ();
   call ("header_bob");
   EXIT_BLOCK
     {
	call ("header_bob");
	collapse_threads ();
     }

   variable mid, msgids = {};

   do
     {
	if (Scorefile_Score == get_header_score ())
	  {
	     mid = extract_article_header ("Message-ID");
	     list_append (msgids, mid);
             set_header_flags(get_header_flags() | HEADER_READ);
	  }
     } 
   while (header_down(1));

   if (length (msgids) == 0)
     return;

   variable 
     scorefile = make_home_filename (get_variable_value ("scorefile")),
     expires = strftime("%m/%d/%Y", 
			localtime(_time() + Subthread_Expires*86400)),
     fp = fopen (scorefile, "a");

   if (fp == NULL)
     throw IOError, "Unable to open $scorefile"$;
   
   if ((-1 == fprintf (fp, "\n%%BOS\n%% Score auto generated by %s at %s\n",
		      _function_name (), time ()))
       || (-1 == fprintf (fp, "[%s]\n\tScore:: %d\n\tExpires: %s\n",
			  current_newsgroup (), Subthread_Score, expires)))
     return;
   
   foreach mid (msgids)
     {
	if (-1 == fprintf (fp,"\tReferences: %s\n", 
			   str_quote_string (mid, "\\^$[]*.+?", '\\')))
	  return;
     }
   () = fprintf (fp, "%%EOS\n");
   () = fclose (fp);
   reload_scorefile (1);
}

() = register_hook ("article_mode_hook", &auto_kill_fups);
#v-
Technical Details
Message-ID: <slrnh769m0.nk4.jed@aluche.mit.edu>
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!border1.nntp.ams.giganews.com!nntp.giganews.com!zen.net.uk!dedekind.zen.co.uk!news.glorb.com!xmission!newsswitch.lcs.mit.edu!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!dreaderd!not-for-mail
References: <guhtt9$82j$1@news.motzarella.org> <slrnh0p4lk.9q2.catwheezel@ID-107770.user.individual.net> <slrnh6sm2b.be4.ShadowTek@desktop.localdomain> <20090729080451@usenet.piggo.com> <slrnh6v215.m8d.ShadowTek@desktop.localdomain> <20090729101510@usenet.piggo.com> <slrnh6vnoo.8ce.ShadowTek@desktop.localdomain> <slrnh73i74.imu.jed@aluche.mit.edu> <20090731083455@usenet.piggo.com> <slrnh749g4.qr1.usenet@news.piggo.com> <slrnh74t48.4ch.jed@aluche.mit.edu> <20090731235846@usenet.piggo.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnh769m0.nk4.jed@aluche.mit.edu>
Subject: Re: [slrn] turbo-plonk.sl improved (Was: Can I make a rule that will auto-ignore all follow-ups to a certain author?)
Date: Fri, 31 Jul 2009 17:15:44 +0000
From: "John E. Davis" <jed@jedsoft.org>
References: <guhtt9$82j$1@news.motzarella.org> <slrnh0p4lk.9q2.catwheezel@ID-107770.user.individual.net> <slrnh6sm2b.be4.ShadowTek@desktop.localdomain> <20090729080451@usenet.piggo.com> <slrnh6v215.m8d.ShadowTek@desktop.localdomain> <20090729101510@usenet.piggo.com> <slrnh6vnoo.8ce.ShadowTek@desktop.localdomain> <slrnh73i74.imu.jed@aluche.mit.edu> <20090731083455@usenet.piggo.com> <slrnh749g4.qr1.usenet@news.piggo.com> <slrnh74t48.4ch.jed@aluche.mit.edu> <20090731235846@usenet.piggo.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!border1.nntp.ams.giganews.com!nntp.giganews.com!zen.net.uk!dedekind.zen.co.uk!news.glorb.com!xmission!newsswitch.lcs.mit.edu!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!dreaderd!not-for-mail
Newsgroups: news.software.readers
Reply-To: davis@space.mit.edu
User-Agent: slrn/pre1.0.0-12 (Linux)
Lines: 71
NNTP-Posting-Host: ALUCHE.MIT.EDU
X-Trace: 1249060544 senator-bedfellow.mit.edu 514 18.75.2.45