🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #255459

Re: [slrn] Solution to the age-old question

#255459
From: ernobe
Date: Fri, 06 Sep 2013 16:50
176 lines
7886 bytes
> I gave up on a previous attempt to solve what is a pretty simple problem 
> because it required a complex set of macros which placed too much burden on 
> slrn and still didn't solve the problem completely.  
>
> The problem is how to place a mark on only the latest never before seen 
> messages within a thread.  
>
> The other attempt had to reconstruct the whole thread on entry to the group, 
> and all the other messages within it appeared marked as read.  So here is the 
> real deal.  It only takes a pretty simple Icon program, running slrnpull in 
> rebuild mode, scoring the articles by age, a simple macro within slrn to tag 
> the newest articles, and setting sorting method to custom for better 
> appearance of the results.  
>
> The Icon program changes the date of each article to yesterday with the --date 
> option of date in Unix ( date --date=yesterday ).  Before running slrnpull 
> you have to run it with the --rebuild option so as to rebuild the overview 
> files.  By scoring the articles that are younger than one day, like this
>
> [*]
> Score: 1
> Age: 1
>
> then all the newer articles received from the server are the only ones to 
> receive a high score and are distinguished with a mark within slrn.  If the 
> last time you downloaded was more than one day ago you will have to change the 
> behaviour of the date command and the score accordingly.
>

I think I've spotted a bug in slrn.  If I change the score file in .slrnrc it 
will continue to read the default score file of slrnpull.

I've resolved the above problem of having to download within the fixed time 
specified in the code.  Instead of changing the date, it is possible to add a 
number to the date line and use it to score the article ( it still reads the 
date OK ), and to obtain its message id and place it in the stickytags file.  
That way the tag is permanent ( until the next download ) and the number 
placed in the date line makes it possible to organize the results by score 
in the article pane.

When a new group is added, I only put a limit on the age of articles ( not 
their number ) like this:

[*]
Score: -1
~Age: 7

so that articles over 7 days old are not downloaded.  Then run my program on 
it like this:

$~/slnews comp/lang/icon

replacing the dots with slashes.  This will initialize the group(s).  It only 
adds a new header to each article.  Without arguments, the program looks for 
new articles ( those which don't have the header ) in groups specified in its 
configuration file.  It does three things to them:

1) obtain the message-id and place it in the .slrn-stickytags file.
2) add a number to the date line, ( I use the Linux command 'date +%s' which 
is the number of seconds since 1970, it is a unique number for every time 
the program is run ).  The date line then looks like this:

Date: Fri, 6 Sep 2013 01:47:19 +0000 (UTC) 1378439505

The last number is the one added.
3) add a new header ( 'X-URL: ' ) to mark it as done for the next time.

It also creates a file which is included in the score file with the include 
command:

include scoring

The 'scoring' file only contains the number above:

[*]
Score: 1
Date: 1378439505

The sorting method set in .slrnrc is the same as in the previous program.  The 
min_high_score setting is different.  It is set to 2, and max_low_score is 
left at the default setting.

set min_high_score 2

When you do catchup, all articles except the tagged ones ( the newest ones ) 
are deleted.  Then after downloading the next time, run the program without 
any arguments, having placed the path to the groups, ending with a slash, in 
the configuration file.  If you've configured .slrnrc as mentioned, at the top 
you will have articles and threads that you've read ( if you've read all the 
articles that were new the previous time ) but which no one has replied to.  
Next will be articles and threads that are new ( not part of threads you have 
read the previous time ).  These are all tagged.  Finally there will be 
threads containing articles you've read and newer, tagged ones.  What I do 
is re-read those articles at the top, which no one has replied to ( asking 
myself why no one has replied to them ).  Then simply use the tag navigating 
functions mentioned in the original post to navigate to the newer tagged 
articles, reply to them if there is something worth replying to, then catchup 
the group and repeat.

Here is the modified Icon program:

global q, u
procedure main( x )
d := []
u := " " || read( open( "date +%s", "p" ) )
if \x[ 1 ] then every mani( !x )
else
    { q := open( "/home/roy/.slrn-stickytags", "crw" ) | stop( "unable to create slrn-stickytags" )
    s4 := open( "/home/roy/News/spool/newupd.conf" ) | stop( "no slrnpull conf file" )
    s5 := open( "/home/roy/News/spool/scoring", "crw" ) | stop( "unable to create scoring" )
    write( s5, "[*]\nScore: 1\nDate:", u )
    while a := read( s4 ) do
	{ if a[ 1 ] == "#" then next 
	put( d, a )
	} 
    every man( !d )
    }
end

procedure man( s )
n := open( "ls " || s, "p" ) | stop( "unable to list ", s )
while p := read( n ) do 
    { numeric( p ) | next
    a := open( s2 := s || p, "rw" ) | stop( "unable to open a:", s2 )
    g := read( a )
    if g == "X-URL: " then
	{ close( a )
	next
	} 
    else 
	{ t := open( s3 := s2 || "new", "crw" ) | stop( "unable to open t:", s3 )
	write( t, "X-URL: \n", g )
	while b := read( a ) do
	    { case b[1:7] of {
		"Messag" : write( q, b[13:0] )
		"Date: " : { write( t, b, u ) 
		    next 
		    }
		}
	    write( t, b )
	    }
	}
    close( a )
    close( t )
    system( "mv " || s3 || " " || s2 )
    }
close( n )
write( "finished ", s )
return
end

procedure mani( si )
ti := "/home/roy/News/spool/news/" || si || "/"
n := open( "ls " || ti, "p" ) | stop( "unable to list ", s )
write( "initializing ", ti, "..." )
while p := read( n ) do 
    { numeric( p ) | next
    a := open( s2 := ti || p, "rw" ) | stop( "unable to open a:", s2 )
    t := open( s3 := s2 || "new", "crw" ) | stop( "unable to open t:", s3 )
    write( t, "X-URL: " )
    while b := read( a ) do write( t, b )
    close( a )
    close( t )
    system( "mv " || s3 || " " || s2 )
    }
close( n )
write( "done" )
return
end
		    

-- 
"The world of existence is an emanation of the merciful attribute of God."
Abdu'l-Baha
http://www.costarricense.cr/pagina/ernobe
Technical Details
Message-ID: <l0d15f$n9n$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!nntp.giganews.com!hk9no11646523wib.1!news-out.google.com!v3ni54589wiv.1!nntp.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
References: <kvj8oe$f5$1@dont-email.me>

Show Full Headers
Complete Article Headers
Message-ID: <l0d15f$n9n$1@dont-email.me>
Subject: Re: [slrn] Solution to the age-old question
Date: Fri, 06 Sep 2013 16:50:56 +0000
From: ernobe <ernobe@yahoo.com>
References: <kvj8oe$f5$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!nntp.giganews.com!hk9no11646523wib.1!news-out.google.com!v3ni54589wiv.1!nntp.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
X-Received: by 10.180.98.74 with SMTP id eg10mr1207235wib.7.1378486257860;
MIME-Version: 1.0
Newsgroups: news.software.readers
Organization: World Order of Baha'u'llah
Lines: 176
Injection-Date: Fri, 6 Sep 2013 16:50:56 +0000 (UTC)
Injection-Info: mx05.eternal-september.org;
 posting-host="aa62c9dfd94aa8dd21cd89a27766d80d";
 logging-data="23863"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX1+BbaX9K1FXo3EmtuZo8uWq"
User-Agent: slrn/pre1.0.0-18 (Linux)
Cancel-Lock: sha1:nTXTfVf0+7am4kPkG8odgPf5iC8=
X-Original-Bytes: 7664