🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #40029

Re: slrn: save all unread articles?

#40029
From: 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/

Technical Details
Message-ID: <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
References: <slrn6il857.7d1.haferman@table.jps.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6im7dg.e94.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>
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: 341976144
Organization: Department of Mathematics, The Ohio State University
Reply-To: lahvak@math.mps.ohio-state.edu
Newsgroups: news.software.readers