🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #137824

Re: [slrn] Why is my scorefile entry being skipped?

#137824
From: Thomas Schultz
Date: Thu, 20 Nov 2003 12:46
111 lines
4733 bytes
* J.B. Nicholson-Owens [2003-11-10 22:53] :
[...]
> I confirmed this with the following version of slrn and it appears to
> me to be a bug.  slrn should score "slrn" posts in
> news.software.readers 150 points.

It is indeed a bug (or rather, a misfeature); I'll try to explain it:

When parsing the scorefile, slrn puts the rules into different chains,
depending on the section (specified in square brackets) they are in.
When scoring the article later, it uses the chains that apply to the
current group - the advantage of this is that the test "Does this rule
apply to this group?" has to be done only once per chain, not once per
rule.

In our example, both rules that apply to all groups get added to the
same chain and as the chain existed before the chain for
news.software.readers, they are both applied before the special rule
for nsr.

What I did now was to remove the logic that finds out whether a chain
with the same label already exists - instead, I'm now simply appending
a new chain whenever you start a new section in your score file. This
might make scoring a little bit slower in case the sections in your
score file are very "fragmented", but will lead to the expected
behaviour in any case.

Here is the patch:

--- slrn-0.9.8.0/src/score.c	2003-07-29 21:09:29.000000000 +0200
+++ slrn/src/score.c	2003-11-13 10:15:29.000000000 +0100
@@ -201,7 +201,7 @@
 }
 
 static Group_Score_Type *Group_Score_Root;
-static Group_Score_Type *Group_Score_Next;
+static Group_Score_Type *Group_Score_Tail;
 static Score_Type *Score_Root, *Score_Tail;
 
 int Slrn_Apply_Score = 1;
@@ -789,36 +789,22 @@
    
    if (new_group_flag)
      {
-	Group_Score_Type *gst, *tail;
+	Group_Score_Type *gst;
+
+	gst = (Group_Score_Type *) slrn_safe_malloc (sizeof (Group_Score_Type));
 	
-	tail = Group_Score_Next = Group_Score_Root;
-	while (Group_Score_Next != NULL)
-	  {
-	     if ((Group_Score_Next->gsnt.next == NULL)
-		 && (Group_Score_Next->gst_not_flag == gst_not_flag)
-		 && !strcmp ((char *) group, Group_Score_Next->gsnt.name))
-	       break;
-	     tail = Group_Score_Next;
-	     Group_Score_Next = Group_Score_Next->next;
-	  }
+	if (-1 == compile_group_names ((char *)group, gst))
+	  return NULL;
 	
-	if (Group_Score_Next == NULL)
+	gst->gst_not_flag = gst_not_flag;
+	
+	if (Group_Score_Root == NULL)
 	  {
-	     gst = (Group_Score_Type *) slrn_safe_malloc (sizeof (Group_Score_Type));
-	     
-	     if (-1 == compile_group_names ((char *)group, gst))
-	       return NULL;
-	     
-	     gst->gst_not_flag = gst_not_flag;
-
-	     if (Group_Score_Root == NULL)
-	       {
-		  Group_Score_Root = gst;
-	       }
-	     else tail->next = gst;
-	     
-	     Group_Score_Next = gst;
+	     Group_Score_Root = gst;
 	  }
+	else
+	  Group_Score_Tail->next = gst;
+	Group_Score_Tail = gst;
      }
    
    /* Now create the PseudoScore type and add it. */
@@ -835,13 +821,13 @@
    else
      pst->description = slrn_safe_strmalloc ((char *)"");
 
-   if (Group_Score_Next->pst == NULL)
+   if (Group_Score_Tail->pst == NULL)
      {
-	Group_Score_Next->pst = pst;
+	Group_Score_Tail->pst = pst;
      }
    else
      {
-	PScore_Type *last = Group_Score_Next->pst;
+	PScore_Type *last = Group_Score_Tail->pst;
 	while (last->next != NULL) last = last->next;
 	last->next = pst;
      }
-- 
Thomas Schultz <tststs@gmx.de>  News on slrn: http://slrn.sf.net/news.html
.-----------------------------. [2003-08-25] Released slrn 0.9.8.0
| Home of the slrn newsreader | [2003-08-19] New slrn FAQ available
| http://slrn.sourceforge.net | [2003-07-31] First beta with offline reading
Technical Details
Message-ID: <slrnbrpdt8.1e5.tststs@moonlight.tststs.ddns.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!internal1.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.cwix.com!newsfeed.vmunix.org!fu-berlin.de!uni-berlin.de!acb7d349.ipt.aol.COM!not-for-mail
References: <slrnbqqdvb.djd.me@yomomma.example.net> <slrnbr05ol.bv8.jbn@forestfield.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrnbrpdt8.1e5.tststs@moonlight.tststs.ddns.org>
Subject: Re: [slrn] Why is my scorefile entry being skipped?
Date: Thu, 20 Nov 2003 12:46:32 +0000
From: Thomas Schultz <tststs@gmx.de>
References: <slrnbqqdvb.djd.me@yomomma.example.net> <slrnbr05ol.bv8.jbn@forestfield.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!internal1.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.cwix.com!newsfeed.vmunix.org!fu-berlin.de!uni-berlin.de!acb7d349.ipt.aol.COM!not-for-mail
Newsgroups: news.software.readers
Organization: Pinguin online.
Lines: 111
NNTP-Posting-Host: acb7d349.ipt.aol.com (172.183.211.73)
X-Trace: news.uni-berlin.de 1069332031 58821702 172.183.211.73 (16 [152])
User-Agent: slrn/0.9.8.0 (Linux)