🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #45904

Re: [SLRN] how to delete automarically reply threads?

#45904
From: Dawn Owens-Nicholson
Date: Tue, 12 Jan 1999 00:00
75 lines
2863 bytes
Matthias.Maisenbacher wrote:
> I'm looking for a method (maybe a macro) to delete all threads which
> start with a re: arcicle.

Put these three functions into a file:

     define delete_thread ()
     {
	if (is_group_mode ())
	  error (_function_name () + " doesn't work in group mode!");

	variable
	  starting_article = extract_article_header ("Message-ID"),
	  starting_thread_was_collapsed = is_thread_collapsed ();

	collapse_thread ();
	call ("delete_thread");
	set_input_string (starting_article);
	call ("locate_header_by_msgid");
	if (starting_thread_was_collapsed) collapse_thread ();
     }

     define goto_end_of_thread ()
     {
	if (is_group_mode ())
	  error (_function_name () + " doesn't work in group mode!");

	collapse_thread ();
	uncollapse_thread ();
	() = header_down (thread_size () - 1);
     }

     define delete_re_threads ()
     {
	if (is_group_mode ())
	  error (_function_name () + " doesn't work in group mode!");

	variable
	  starting_article = extract_article_header ("Message-ID"),
	  starting_thread_was_collapsed = is_thread_collapsed (),
	  thread_was_collapsed = 0;

	call ("header_bob");

	do
	  {
	     thread_was_collapsed = is_thread_collapsed ();
	     if (string_match (extract_article_header ("Subject"), "^Re: ", 1))
	       delete_thread ();
	     goto_end_of_thread ();
	     if (thread_was_collapsed) collapse_thread ();
	  }
	while (header_down (1));

	set_input_string (starting_article);
	call ("locate_header_by_msgid");
	if (starting_thread_was_collapsed) collapse_thread ();
     }

You didn't say how you wanted to handle sub-threads starting with articles
with Subject: headers that don't match "^Re: ", so I decided to keep the
function simple by not handling them--they get marked as read too.  I didn't
bother to remove the duplicate collapse_thread()s because they don't cost
much time to execute and now you've got two functions you can easily reuse.

Run this from article_mode_hook() by defining the hook thusly:

     define article_mode_hook ()
     {
        delete_re_threads ();
     }

Of course, other code can run in the hook too.  Happy newsreading!

Technical Details
Message-ID: <slrn79ncht.7dq.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: <77f9t2$eo8$2@news.fr.internet.bosch.de>

Show Full Headers
Complete Article Headers
Message-ID: <slrn79ncht.7dq.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: [SLRN] how to delete automarically reply threads?
Date: Tue, 12 Jan 1999 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <77f9t2$eo8$2@news.fr.internet.bosch.de>
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: 431793417
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.4 (UNIX)
Newsgroups: news.software.readers