🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #48530

Re: view complete threads in slrn, how?

#48530
From: John E. Davis
Date: Wed, 12 May 1999 00:00
104 lines
3731 bytes
On Wed, 12 May 1999 17:04:46 +0200, Remco van den Berg <Remco.vdBerg@ehv.sc.philips.com>
wrote:
>for i in "all unread headers"
>do
>  complete_thread = calculate_all headers_in_thread( $i );
>  for j in $complete_thread
>  do
>    show_header( $j );
>  done
>done
[...]
>And after I've programmed such macro, how can I connect that to
>the article_mode_hook? (Yes, I printed out a pile of docs but I
>cannot find answers anyware... Perhaps I printed the wrong ones :)

You need to browse the slang documentation.  Look on www.s-lang.org
for links to that.  The following code uses a different algorithm that
does not require querying the server by message-id, which may be an
expensive operation.  However, it does require that all the headers
for the group be downloaded.  Use the SPACE key in group mode to get
this behavior, otherwise use RETURN to get the default slrn behavior.

This code requires slang 1.3.5.  It is available from

      ftp://space.mit.edu/pub/davis/slang/snapshots/

define thread_headers ()
{
   variable s = get_variable_value ("sorting_method");
   ungetkey ('1');
   call ("toggle_sort");

   return s;
}

define xpunge_read_threads ()
{
   variable msgid_list, flags;
   variable sort_method, msgid;

   msgid_list = Assoc_Type[Int_Type];

   % Get the message-ids of all unread headers
   call ("header_bob");
   do
     {
	flags = get_header_flags ();
	if (0 == (flags & HEADER_READ))
	  msgid_list[extract_article_header ("Message-ID")] = flags;
     }
   while (header_down(1));
   
   % Now thread and mark those with unread articles as unread
   sort_method = thread_headers ();
   
   foreach (msgid_list) using ("keys")
     {
	msgid = ();
	() = locate_header_by_msgid (msgid, 0);
	collapse_thread ();
	call ("undelete");
     }
   set_integer_variable ("sorting_method", sort_method);
   
   % Now kick out the ones that are still marked as read
   call ("art_xpunge");
   % There may be nothing left after this putting us back in group mode
   if (is_group_mode ())
     return;
	   
   call ("header_bob");
   uncollapse_threads ();
   do
     {
	msgid = extract_article_header ("Message-ID");
	if (0 == assoc_key_exists (msgid_list, msgid))
	  set_header_flags (get_header_flags () | HEADER_READ);
     }
   while (header_down (1));

   call ("header_bob");
}

static variable Delete_Read_Threads = 0;

define article_mode_hook ()
{
   if (Delete_Read_Threads)
     xpunge_read_threads ();
}

define my_enter_group_cmd ()
{
   set_prefix_argument (1);
   ungetkey ('\r');
   Delete_Read_Threads = 1;
   () = select_group ();
   Delete_Read_Threads = 0;
}

definekey ("my_enter_group_cmd", " ", "group");


Technical Details
Message-ID: <slrn7jjn6g.m02.davis@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.mbox.zip!not-for-mail
References: <slrn7jgna2.ctn.rvdberg@jupiter.strijp.Ehv.nl> <slrn7jgoem.i6v.davis@aluche.mit.edu> <37394CBE.A3D81DF1@ehv.sc.philips.com> <slrn7jit78.lba.davis@aluche.mit.edu> <3739988E.EED44497@ehv.sc.philips.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrn7jjn6g.m02.davis@aluche.mit.edu>
Subject: Re: view complete threads in slrn, how?
Date: Wed, 12 May 1999 00:00:00 +0000
From: davis@space.mit.edu (John E. Davis)
References: <slrn7jgna2.ctn.rvdberg@jupiter.strijp.Ehv.nl> <slrn7jgoem.i6v.davis@aluche.mit.edu> <37394CBE.A3D81DF1@ehv.sc.philips.com> <slrn7jit78.lba.davis@aluche.mit.edu> <3739988E.EED44497@ehv.sc.philips.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.mbox.zip!not-for-mail
X-Deja-AN: 477134323
X-Complaints-To: usenet@eecs-usenet-02.mit.edu
X-Trace: eecs-usenet-02.mit.edu 926538963 9819 18.75.2.45 (12 May 1999 19:56:03 GMT)
Organization: Center for Space Research
User-Agent: slrn/0.9.5.5 (UNIX)
Reply-To: davis@space.mit.edu
NNTP-Posting-Date: 12 May 1999 19:56:03 GMT
Newsgroups: news.software.readers