🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #40038

Re: slrn: save all unread articles?

#40038
From: Jan Hlavacek
Date: Wed, 08 Apr 1998 00:00
87 lines
3020 bytes
On 8 Apr 1998 06:48:16 GMT, Jan Hlavacek
<lahvak@math.mps.ohio-state.edu> wrote:
> On 7 Apr 1998 14:54:47 -0700, Jeff Haferman <haferman@table.jps.net>
> wrote:
> > 
> > Suppose I want to save all unread articles in a given newgroup
> > to a file (using slrn).  What is the "best" way to do so?
> 
> Try this:

And here is a little fix,  so you  can interrupt it with space bar even
in the middle of a thread.

define append_to_file (file)
{
   % We need to clear error in case of unavailable articles
   ERROR_BLOCK
   {
      _clear_error ();
   }

   set_input_string (file);
   call ("save");
}

define save_unread (file)
{
   if (is_group_mode ()) return; % doesn't work in group mode

   % remember where we are:
   variable msgid = extract_article_header ("Message-ID");
   variable is_collapsed = is_thread_collapsed ();

   EXIT_BLOCK
   {
      % return back
      set_input_string (msgid);
      call ("locate_header_by_msgid");
      % The previous line uncollapsed the thread if it was collapsed.
      % Fix it:
      if (is_collapsed) collapse_thread ();
   }


   % go to the beginig
   call ("header_bob");
   do
   {
      % spacebar interrupts
      if (andelse {input_pending (0)} {getkey () == ' '})
	 return;
      if (is_thread_collapsed ())
      % it is collapsed,  we have to uncollapse it,  cycle through it
      % and restore it back
      {
	 uncollapse_thread ();
	 loop (thread_size () - 1)  % stay on the last one
	 {
	    % spacebar interrupts
	    if (andelse {input_pending (0)} {getkey () == ' '})
	    {
	       collapse_thread ();
	       return;
	    }
	    !if (get_header_flags () & HEADER_READ) 
	       append_to_file (file);
	    () = header_down (1);
	 }
	 % no save the last one, too
	 !if (get_header_flags () & HEADER_READ) 
	    append_to_file (file);
	 collapse_thread ();
      }
      else !if (get_header_flags () & HEADER_READ) 
	       append_to_file (file);
   }
   while (header_down (1));
}

-- 
Jan Hlav\'{a}\v{c}ek <lahvak@math.mps.ohio-state.edu>  (BCC's will bounce)
home page: http://www.math.ohio-state.edu/~lahvak/
slrn page: http://www.math.ohio-state.edu/~lahvak/software/slrn.html
slrn documentation: http://www.math.ohio-state.edu/~lahvak/software/slrn/

Technical Details
Message-ID: <slrn6inaga.r94.lahvak@math.mps.ohio-state.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: <slrn6il857.7d1.haferman@table.jps.net> <slrn6im7dg.e94.lahvak@math.mps.ohio-state.edu>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6inaga.r94.lahvak@math.mps.ohio-state.edu>
Subject: Re: slrn: save all unread articles?
Date: Wed, 08 Apr 1998 00:00:00 +0000
From: lahvak@math.mps.ohio-state.edu (Jan Hlavacek)
References: <slrn6il857.7d1.haferman@table.jps.net> <slrn6im7dg.e94.lahvak@math.mps.ohio-state.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
X-Deja-AN: 342111544
Organization: Department of Mathematics, The Ohio State University
Reply-To: lahvak@math.mps.ohio-state.edu
Newsgroups: news.software.readers