🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
3 messages
3 total messages Started by Jeff Haferman Tue, 07 Apr 1998 00:00
slrn: save all unread articles?
#40014
Author: Jeff Haferman
Date: Tue, 07 Apr 1998 00:00
8 lines
703 bytes

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?



Re: slrn: save all unread articles?
#40029
Author: Jan Hlavacek
Date: Wed, 08 Apr 1998 00:00
69 lines
2462 bytes
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:

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");
   % go to the beginig
   call ("header_bob");
   do
   {
      % spacebar interrupts,  but not inside threads - can be fixed
      if (andelse {input_pending (0)} {getkey () == ' '})
	 break;
      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
	 {
	    !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));
   % and return back
   set_input_string (msgid);
   call ("locate_header_by_msgid");
}

Good luck!

lahvak
-- 
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/

Re: slrn: save all unread articles?
#40038
Author: 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/

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads