Article View: news.software.readers
Article #265032Re: slrn: Sort most recently active threads first?
From: Tavis Ormandy
Date: Thu, 17 Jun 2021 18:58
Date: Thu, 17 Jun 2021 18:58
72 lines
2949 bytes
2949 bytes
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.
Ah, I don't think that's possible.
There is no sorting hook, so you can't override how articles are
compared with macros, it's all hardcoded.
It would be nice if you could write an article_mode_hook that changes
the date, but you can't do anything like replace_article() then AFAIK.
Wait... LOL.. just as I was writing this reply saying it was impossible,
I realized how you could do it. It's a weird solution, so be prepared :-)
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? Slrn automatically
propogates the highest score to the thread, then you can sort by score before
reapplying the old scores.
Believe it or not, I think this works!
Try the macro below.
Tavis.
define score_child_date ()
{
variable score = Assoc_Type[Int_Type, 0];
variable flags = Assoc_Type[Int_Type, 0];
variable date;
variable meth;
variable mid;
uncollapse_threads();
header_bob();
do {
date = extract_article_header("Date");
mid = extract_article_header("Message-ID");
score[mid] = get_header_score();
flags[mid] = get_header_flags();
set_header_score(datestring_to_unixtime(date));
} while (header_down(1) == 1);
meth = get_variable_value("sorting_method");
set_integer_variable("sorting_method", 5);
sort_by_sorting_method();
uncollapse_threads();
set_integer_variable("sorting_method", meth);
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:
<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-mailReferences:
<Vf-dnZxW26zvs1f9nZ2dnUU7-YednZ2d@giganews.com> <ij185cFc4i6U1@mid.individual.net> <l42dnRHMzoRd9lb9nZ2dnUU7-fednZ2d@giganews.com>Show Full Headers
Complete Article Headers
Message-ID: <ij1kb1FekeqU1@mid.individual.net> Subject: Re: slrn: Sort most recently active threads first? Date: Thu, 17 Jun 2021 18:58:41 +0000 From: Tavis Ormandy <taviso@gmail.com> References: <Vf-dnZxW26zvs1f9nZ2dnUU7-YednZ2d@giganews.com> <ij185cFc4i6U1@mid.individual.net> <l42dnRHMzoRd9lb9nZ2dnUU7-fednZ2d@giganews.com> 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 User-Agent: slrn/1.0.3 (Linux) Newsgroups: news.software.readers Cancel-Lock: sha1:7wfVapmKpgpGhD3KbC2OpDoFBrA= X-Trace: individual.net Rmic5IQZeDASpzmZTV4PuwrfUr+j7leGXYDCrUtcWe+Ur1WpA6 Lines: 72