🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #42035

Re: Needed SLRN function

#42035
From: Dawn Owens-Nicholson
Date: Sat, 11 Jul 1998 00:00
85 lines
3565 bytes
Steve Lamb <morpheus@calweb.com> wrote:
>     OK, I know that Cin the article display will mark all articles from the
> top to the current position as read, but is there a way to mark from the
> bottom to the current position as read?

This topic (or something related) came up recently, you should check
DejaNews (http://www.dejanews.com) for specifics.  Anyhow, I think you could
make a macro to do this fairly quickly.  I'm using a wrapper around the
intrinsic locate_header_by_msgid because I want to preserve the threading
display.  You'll want to bind mark_read_to_end to a key.  Hope this helps!

define bugfix_locate_header_by_msgid ()
{
   % This macro fixes the following known locate_header_by_msgid() bugs:
   %
   % (1) With collapsed threads, the intrinsic will unnecessarily uncollapse
   %     a thread.
   %
   % This macro only uses the bug-free portions of the intrinsic by calling
   % it at a time when it is known to work well.

   variable sought_message_ID = read_mini ("Enter Message-Id", "", "");
   !if (strlen (sought_message_ID)) return ();

   variable starting_header = extract_article_header ("Message-ID");

   call ("header_bob");                          % go to top of article list

   % The do-while loop moves the pointer from thread to thread while the
   % inner for loop checks the articles in each thread.  The collapse
   % status of the display is only disturbed when the desired message-ID
   % is found inside a thread.
   do
     {
	variable
	  thread_was_collapsed = is_thread_collapsed (),
	  t_size = thread_size (),
	  position;

	for (position = 1; position <= t_size; position++)
	  {
	     if (sought_message_ID == extract_article_header ("Message-ID"))
	       return ();

	     if (position == 1) uncollapse_thread ();
	     else if (andelse
		       { position == t_size }    % at end of thread
		       { thread_was_collapsed })
	       collapse_thread ();

	     if (position != t_size) () = header_down (1);
	  }
     }
   while (header_down (1));

   % moving to starting place
   set_input_string (starting_header);    call ("locate_header_by_msgid");

   % calling the non-buggy part
   set_input_string (sought_message_ID);  call ("locate_header_by_msgid");
}

define mark_read_to_end ()
{
   if (is_group_mode ())
     verror ("%s doesn't work in group mode!", _function_name ());

   variable
     previous_message_ID = "",                   % msg-ID to be marked read
     message_ID = "",                            % following msg-ID
     starting_place = extract_article_header ("Message-ID");

   do
     {
	previous_message_ID = extract_article_header ("Message-ID");
	call ("delete");
	message_ID = extract_article_header ("Message-ID");
     }
   while (previous_message_ID != message_ID);

   set_input_string (starting_place);            % go back where we started
   bugfix_locate_header_by_msgid ();
}

Technical Details
Message-ID: <slrn6qfi3o.70j.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: <slrn6qf1pk.fqt.morpheus@teleute.dyn.ml.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6qfi3o.70j.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: Needed SLRN function
Date: Sat, 11 Jul 1998 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <slrn6qf1pk.fqt.morpheus@teleute.dyn.ml.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: 370559689
Organization: University of Illinois at Urbana-Champaign
Newsgroups: news.software.readers