🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #265035

Re: slrn: Sort most recently active threads first?

#265035
From: Tavis Ormandy
Date: Thu, 17 Jun 2021 23:19
68 lines
2778 bytes
On 2021-06-17, Tavis Ormandy wrote:
> On 2021-06-17, Jay wrote:
>> Thanks. That doesn't quite work; it still sorts by the date of the highest
>> ancestor of a thread, not by the most recent message in any given thread.
>
> You can't alter articles in article_mode_hook, but you can adjust the
> score. What if you temporarily set the score of each article to the
> unixtime it was sent, sort it, then change it back?

I made some improvements:

    - Using UNIX time works but doesn't handle timezones. A better idea
      is to make slrn sort it then reuse whatever index it assigns the message.
    - It turns out sorting updates the flags displayed, so they were out
      of sync.

I've been using it today, I kinda like it.

I think you just need this in your .slrnrc:

interpret "util.sl"
interpret "/path/to/this/macro.sl"

Then save the following macro somewhere.

define score_child_date ()
{
    variable score = Assoc_Type[Int_Type, 0];
    variable flags = Assoc_Type[Int_Type, 0];
    variable mid;
    variable num = 0;

    set_integer_variable("sorting_method", 10);
    sort_by_sorting_method();

    header_bob();

    do {
        mid = extract_article_header("Message-ID");
        score[mid] = get_header_score();
        flags[mid] = get_header_flags();
        set_header_score(num);
        set_header_flags(flags[mid]);
        num = num + 1;
    } while (header_down(1) == 1);

    set_integer_variable("sorting_method", 5);
    sort_by_sorting_method();
    uncollapse_threads();

    header_bob();

    do {
        mid = extract_article_header("Message-ID");
        set_header_score(score[mid]);
        set_header_flags(flags[mid]);
    } while (header_down(1) == 1);

    header_bob();
    collapse_threads();
}

() = register_hook("article_mode_startup_hook", "score_child_date");

-- 
 _o)            $ lynx lock.cmpxchg8b.com
 /\\  _o)  _o)  $ finger taviso@sdf.org
_\_V _( ) _( )  @taviso
Technical Details
Message-ID: <ij23jfFhbdnU1@mid.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <Vf-dnZxW26zvs1f9nZ2dnUU7-YednZ2d@giganews.com> <ij185cFc4i6U1@mid.individual.net> <l42dnRHMzoRd9lb9nZ2dnUU7-fednZ2d@giganews.com> <ij1kb1FekeqU1@mid.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <ij23jfFhbdnU1@mid.individual.net>
Subject: Re: slrn: Sort most recently active threads first?
Date: Thu, 17 Jun 2021 23:19:11 +0000
From: Tavis Ormandy <taviso@gmail.com>
References: <Vf-dnZxW26zvs1f9nZ2dnUU7-YednZ2d@giganews.com> <ij185cFc4i6U1@mid.individual.net> <l42dnRHMzoRd9lb9nZ2dnUU7-fednZ2d@giganews.com> <ij1kb1FekeqU1@mid.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Lines: 68
Cancel-Lock: sha1:qmVnCKDZDrCP5AYoAFGVjTYQ+Wk=
User-Agent: slrn/1.0.3 (Linux)
Newsgroups: news.software.readers
X-Trace: individual.net hih67WeXJh3AMWO7UWNoCQQipsJnAIFM+LXbtq7AG52WYyzm6K