🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #53121

Re: [slrn] Macro for killing an entire thread?

#53121
From: Dawn Owens-Nicholson
Date: Wed, 13 Oct 1999 00:00
66 lines
3284 bytes
Christian Perrier wrote:
> [A] macro which would extract from the headers of the current article
> the FIRST References entry and then create a Score entry based on it
> for killing the entire thread.

This won't work as well as you would hope.  Some newsreaders don't preserve
the entire References: header so some references (message-IDs) will be lost
in long threads.  If an early reference (the first message-ID, for instance)
is lost, the article won't be scored as you intend.  Scoring on a single
reference works best when you're trying to kill a subthread--a branch of a
discussion--because they don't often grow very long.

Putting that aside, this may be what you were looking for.  This macro
appends a score entry to the scorefile without going through the kill
prompter (less programming for me, less upkeep for you).  Unfortunately this
means you'll have to hardcode the path to your scorefile (for now--perhaps
in the future slrn's scorefile will become a 'set' variable).

I've modified the request to kill all articles with /any/ of the references
in their References: header so the chance of killing long threads increases.
If you use this macro on the first article in a thread (an article with no
References: header), you can test how well it works on killing an entire
thread according to your original wish.

implements ("my");
static variable scorefile = "path_to_my_scorefile_here";   % <= EDIT THIS LINE!
static define kill_thread ()
{
   if (is_group_mode ())
     error (_function_name () + " doesn\'t work in group mode.");

   variable fp = fopen (scorefile, "a");
   % variable fp = fopen (get_variable_value ("scorefile"), "a");
   if (fp == NULL) error ("Couldn\'t open scorefile: " + errno_string (errno));

   variable line;
   foreach (["[*] % Killing " + extract_article_header ("Subject"),
	     "    Score:: =" + string (get_variable_value ("kill_score"))])
     {
	line = () + "\n";
	if (-1 == fputs (line, fp))
	  error ("Can\'t write to scorefile: " + errno_string (errno));
     }

   variable
     msgID,
     header = "References",
     refs = extract_article_header (header);

   !if (strlen (refs))                           % Must be a thread-starter
     {
	header = "Message-ID";
	refs = extract_article_header (header);
     }
   foreach (strtok (refs))
     {
	msgID = ();
	if (-1 == fputs (sprintf ("       %s: %s\n", header, msgID), fp))
	  error ("Can\'t write to scorefile: " + errno_string (errno));
     }

   if (-1 == fclose (fp))
     error ("Can\'t close scorefile: " + errno_string (errno));
}

Technical Details
Message-ID: <slrn80835v.l6k.bluemoon@ux6.cso.uiuc.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.mbox.zip!not-for-mail
References: <slrn800cjt.r4f.bubulle@mykerinos.kheops.frmug.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrn80835v.l6k.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: [slrn] Macro for killing an entire thread?
Date: Wed, 13 Oct 1999 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <slrn800cjt.r4f.bubulle@mykerinos.kheops.frmug.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 536105623
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.7 (UNIX)
Newsgroups: news.software.readers