🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #73413

[slrn] patch: correct threading of multi-part binaries

#73413
From: Jurriaan (note: this is a workin...
Date: Sun, 11 Mar 2001 20:04
93 lines
5034 bytes
It was amazingly simple, after all:

Just add this function in art.c:

==========================
#ifdef SLRN_HAS_MULTIPART_THREADING
static int subject_multipart_cmp (register unsigned char *sa,
                                  register unsigned char *sb) /*{{{*/
{
   /* take care not to include a (, since it will be the same in both headers
    * thus skipped over.
    */
   static char *multipart_sign = "^[0-9]+/[0-9]+)";
   char compiled_pattern_buf[256];
   SLRegexp_Type re;

   re.pat = (unsigned char *) multipart_sign;
   re.buf = compiled_pattern_buf;
   re.case_sensitive = 0;
   re.buf_len = sizeof (compiled_pattern_buf);
   (void) SLang_regexp_compile(&re);

   /* clear out the part that looks the same */
   while (*sa++ == *sb++)
    {
      if ( (*sa == 0) || (*sb == 0) )
         return 1;
    }

   /* if both headers are the same until now, and they match a regexp
    * showing that they are part of a multi-part binary, they are treated
    * as the same subject
    */
   if ( (NULL != slrn_regexp_match(&re, sa)) &&
        (NULL != slrn_regexp_match(&re, sb)) )
     {
        return 0;
     }
   return 1;
}
#endif
==========================

And then make this tiny change in art.c, function link_same_subjects():

==========================
#ifdef SLRN_HAS_MULTIPART_THREADING
        if  ( (0 == subject_cmp ((unsigned char *) h->subject,
                                 (unsigned char *) h1->subject)) ||
              (0 == subject_multipart_cmp ((unsigned char *) h->subject,
                                           (unsigned char *) h1->subject)) )
#else
        if (0 == subject_cmp ((unsigned char *) h->subject,
                              (unsigned char *) h1->subject))
#endif
==========================

and I see something like this:


slrn 0.9.6.3 ** Press '?' for help, 'q' to quit. ** Server: /var/spool/newszilla/slrnpull/news
 1! - 10009:[mbrown4@cinc] 10 Ani Difranco - (Battery Park, NYC 6-20-98) - 02 - Fuel.mp3 (01/10)
 2! - 10009:[mbrown4@cinc] 10 Ani Difranco - (Battery Park, NYC 6-20-98) - 03 - Two Little Girls.mp3 (01/10)
 3! - 10009:[mbrown4@cinc] 11 Ani Difranco - (Battery Park, NYC 6-20-98) - 04 - Shy.mp3 (01/11)
 4! - 10009:[mbrown4@cinc]   ���Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (1/6)
 5! - 10008:[mbrown4@cinc]    ��Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (2/6)
 6! - 10008:[mbrown4@cinc]    ��Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (3/6)
 7! - 10008:[mbrown4@cinc]    ��Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (4/6)
 8! - 10008:[mbrown4@cinc]    ��Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (5/6)
 9! -  6898:[mbrown4@cinc]    ��Ani Difranco - (Battery Park, NYC 6-20-98) - 05 - Letter to a John.mp3 (6/6)
10! - 10009:[mbrown4@cinc]  8 Ani Difranco - (Battery Park, NYC 6-20-98) - 06 - Pulse.mp3 (1/8)
11! - 10009:[mbrown4@cinc]  7 Ani Difranco - (Battery Park, NYC 6-20-98) - 07 - Upx6.mp3 (1/7)
12! - 10009:[mbrown4@cinc]  5 Ani Difranco - (Battery Park, NYC 6-20-98) - 08 - Loom.mp3 (1/5)

I _like_ this!

Good luck,
Jurriaan

PS: It will soon be part of my patch-set for slrn at
http://www.xs4all.nl/~thunder7 but I'll have to add some more patterns,
and perhaps an indication if a thread is complete or not - but I'm not
sure about that - I have a very good newsserver, so being complete is
the rule :-)

PS2: changing subject_cmp() itself gives interesting results - try it
yourself!
-- 
I am Oprah of Borg. Today, We focus on assimilation, and the futile races
who try to stop us.
GNU/Linux 2.4.2-ac18 SMP/ReiserFS 2x1743 bogomips load av: 0.00 0.00 0.00
Technical Details
Message-ID: <slrn9anm3u.1lf._hate_spam_thunder7@middle.of.nowhere>
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!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!194.109.6.150!transit.news.xs4all.nl!no_spam_here

Show Full Headers
Complete Article Headers
Message-ID: <slrn9anm3u.1lf._hate_spam_thunder7@middle.of.nowhere>
Subject: [slrn] patch: correct threading of multi-part binaries
Date: Sun, 11 Mar 2001 20:04:08 +0000
From: no_spam_here@rivierenland.xs4all.nl (Jurriaan (note: this is a working address!))
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!supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!194.109.6.150!transit.news.xs4all.nl!no_spam_here
Newsgroups: news.software.readers
Organization: XS4ALL Internet BV
Lines: 92
NNTP-Posting-Host: rivierenland.xs4all.nl
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news1.xs4all.nl 984341048 16993 194.109.14.47 (11 Mar 2001 20:04:08 GMT)
X-Complaints-To: abuse@xs4all.nl
NNTP-Posting-Date: 11 Mar 2001 20:04:08 GMT
X-Face: b$-F+98,@$_I=*ODq'<K2(OA)qC&,(GP=z2^`4dwQwy&e;!|R?>")k9FH3?YC+%*kF\=<Rx"Hy2_eyMtnFSiO8
User-Agent: slrn/0.9.6.3 (GNU/Linux)