🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #253205

Re: [slrn] scoring, need help please

#253205
From: andrew
Date: Fri, 04 Jan 2013 23:47
80 lines
3596 bytes
On 2013-01-04, Whiskers <catwheezel@operamail.com> wrote:

> That macro doesn't seem to have made it onto the official slrn site, but I
> can remember using it myself to very good effect to handle a problem
> similar to yours.  I don't know if it would need any changes to work with
> the latest versions of slrn.  (It looks as though the macro is available
> from <http://strcat.de/dotfiles/>, but I haven't checked whether or not
> that is the same thing).

I am away for a fortnight but if a few people can test turbo-plonk.sl I
will be happy to add it to the slrn site:

#v+

private variable Scorefile_Score = -666;
private variable Subthread_Score = -9998;
private variable Subthread_Expires = 21;
private define auto_kill_fups ()
{
   if (is_group_mode ())
     error (_function_name () + " doesn't work in group mode!");

   uncollapse_threads ();
   call ("header_bob");
   EXIT_BLOCK
     {
	call ("header_bob");
	collapse_threads ();
     }

   variable mid, msgids = {};

   do
     {
	if (Scorefile_Score == get_header_score ())
	  {
	     mid = extract_article_header ("Message-ID");
	     list_append (msgids, mid);
             set_header_flags(get_header_flags() | HEADER_READ);
	  }
     } 
   while (header_down(1));

   if (length (msgids) == 0)
     return;

   variable 
     scorefile = make_home_filename (get_variable_value ("scorefile")),
     expires = strftime("%m/%d/%Y", 
			localtime(_time() + Subthread_Expires*86400)),
     fp = fopen (scorefile, "a");

   if (fp == NULL)
     throw IOError, "Unable to open $scorefile"$;
   
   if ((-1 == fprintf (fp, "\n%%BOS\n%% Score auto generated by %s at %s\n",
		      _function_name (), time ()))
       || (-1 == fprintf (fp, "[%s]\n\tScore:: %d\n\tExpires: %s\n",
			  current_newsgroup (), Subthread_Score, expires)))
     return;
   
   foreach mid (msgids)
     {
	if (-1 == fprintf (fp,"\tReferences: %s\n", 
			   str_quote_string (mid, "\\^$[]*.+?", '\\')))
	  return;
     }
   () = fprintf (fp, "%%EOS\n");
   () = fclose (fp);
   reload_scorefile (1);
}

() = register_hook ("article_mode_hook", &auto_kill_fups);

#v-

Andrew

-- 
Do you think that's air you're breathing?
Technical Details
Message-ID: <20130105104431.477@skamandros.andrews-corner.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.20140922.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!news.nosignal.org!cs.uu.nl!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <slrnkdbua7.qr3.feranija@moose.shawcable.net> <slrnkee748.1au.catwheezel@ID-107770.user.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <20130105104431.477@skamandros.andrews-corner.org>
Subject: Re: [slrn] scoring, need help please
Date: Sat, 05 Jan 2013 10:47:41 +1100
From: andrew <andrew@skamandros.invalid>
References: <slrnkdbua7.qr3.feranija@moose.shawcable.net> <slrnkee748.1au.catwheezel@ID-107770.user.individual.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.20140922.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!news.nosignal.org!cs.uu.nl!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Organization: slrn mafia
Lines: 80
X-Trace: individual.net
 1ROVS3Gl6JAAE6eqo/DZIwdxfbnWT6XBVJdODzudp1lgiOi3T71hjSdb5M2ys+UQOq
X-Orig-Path: skamandros.andrews-corner.org!not-for-mail
Cancel-Lock: sha1:c4JmQGK2BN3Zl4ok7XifJiyUE7w=
X-NNTP-Proxy: Leafnode-2
 (http://www-dt.e-technik.uni-dortmund.de/~ma/leafnode/beta/)
User-Agent: slrn/1.0.1 (Linux)
X-Original-Bytes: 3326