Re: Get thread info slrn has in article mode?

Guido Berhoerster <[email protected]> Mon, 17 Feb 2014 00:29:34 +0100
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
* J.B. Nicholson-Owens <[email protected]> [2014-02-16 19:19]:
> In article mode, slrn can show the user a thread tree: a clear 
> indication of which article is an article's parent, and which articles 
> are that article's children (if any). I'd like to get at this thread 
> information in an S-Lang macro for slrn.
> 
> I'd like to get at this information without:
> 
> - adding articles to the thread that aren't already in the visible 
> thread tree. I don't want to reconstruct the whole thread nor do I want 
> to add any articles to the thread display I'm not already seeing.
> 
> - requesting anything from the news server 
> (http://slrn.sourceforge.net/docs/slrn-manual-7.html#akey_get_parent_header 
> says that get_parent_header will download data from the server if 
> necessary).
> 
> - rebuilding thread information by reading References: header data 
> because slrn has apparently already done that plus constructed threads 
> from articles where References: header data is missing. We see the fruit 
> of this work when slrn shows the user the thread tree.
> 
> Is there S-Lang API for slrn to let an S-Lang macro read this thread 
> data? It would be okay if this were read-only data for the macro.

My slrn skills are a bit rusty but I think that information is
only partially available, through has_parent(), thread_size(),
header_up(), and header_down(). So when you have slrn sort by
threads you should be able to traverse a thread downwards from
its topmost article using header_down() the number of times
returned by thread_size(). Traversing upwards from an arbitrary
point to the topmost article works by calling header_up() until
has_parent() returns false. This traversal works without any
additional downloads and allows you to manipulate articles along
the way.
Whether that is good enough or you're better off extracting
References and Message-ID headers manually depends on what
exactly you are trying to do.
For me it was just enough to implement a macro for an alternative
view that only shows threads that have unread articles in them.
-- 
Guido Berhoerster

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk