🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #69500

Re: [slrn] thread_size() & single article

#69500
From: J.B. Nicholson-Owens
Date: Thu, 21 Dec 2000 08:56
105 lines
5632 bytes
cedric wrote:
> As I use leafnode as a local news server, maybe should I set it to 0?
> (that's what I have done for this post, hope this will work...)

Since it's leafnode that is passing the articles to your Usenet server,
perhaps that needs to be reconfigured.  As it stands, you're still posting
with 127.0.0.1 ("Message-ID: <n47s19.4d4.ln@127.0.0.1>").  You might try
making a test post to an appropriate test group (preferably something local
and non-propagated) using slrn in debug mode.  I'm not familiar with
leafnode, but if it acts as a locally-hosted NNTP server, you should be able
to try "slrn --nntp --debug log" then make a post, quit slrn and read the
log file to see what slrn is generating.

> I've configured the navigation under slrn like I've done for mutt: entirely
> with the arrows (like in tin): so in a group, I've 3 types of display:
>    1) one with only a list of threads (collapsed)
>    2) one with the thread consulted uncollapsed
>    3) one like the latter + the article shown
> But when I'm on a single article (visual: no child nor parent displayed, but
> they can exist anyway) I go directly from 1) to 3).

I'm not familiar with mutt, tin or your arrow key navigation.  As I
understand it, you go from seeing this article with no parent displayed to
seeing that thread uncollapsed (and seeing that article's body)?

> My problem is I don't manage in this situation to collapse all other thread
> automatically like it is done when I consult a thread which has children.

If all the other threads (meaning every thread except the thread where the
cursor is?) in the header list collapse when you visit a child article, that
is the work of some macro or patch.  slrn doesn't do that by default.

If you want to collapse every thread except the thread at the cursor, try
this:

  variable thread_was_uncollapsed = not (is_thread_collapsed ());
  collapse_all_threads ();
  if (thread_was_uncollapsed) uncollapse_thread ();

every time you move the cursor from one thread to another.

> I'm using an odd sorting number (7) to sort by threads.
> And that's my problem: I can't distinguish an article that has no children
> from one that has no children nor parents.

Okay, now we're getting somewhere.  Visually speaking (meaning you're only
concerned with the articles in the header list), here's how to determine the
difference between an article without children and an article without
children or parents: (all of this assumes you're in article mode, of course)

  In a threaded sorting method, thread_size() will return 1 for an article
  without children.  That's all there is to that.  If you want to determine
  this in an unthreaded sorting method, that's more involved.

  Regardless of the sorting method

    strchop (extract_article_header ("References"), ' ', 0)[-1]

  is the message-ID of the current article's parent.  You can pass this
  message-ID to locate_header_by_msgid() to determine if that article is in
  the header list.  You'll want to pass 0 as the second argument to
  locate_header_by_msgid() so you don't make slrn attempt to insert the
  article in the header list.  Also if the article is found, the cursor will
  move to that parent article.  So you'll have to compensate for this cursor
  movement.

In other words:

#v+
   variable descendants = thread_size () - 1;
#v-

is one quick way to check for descendant articles.  The current article has
'descendants' number of descendant articles (which means if descendants is
non-zero, the article has at least one child).

#v+
   variable
      previous_message_id = extract_article_header ("Message-ID"),
      parent = strchop (extract_article_header ("References"), ' ', 0)[-1];

   if (andelse { parent != "" } { locate_header_by_msgid (parent, 0) })
     {
        % Now the cursor is at the parent article.
        % .
	% . do something with that article here
	% .
	% Return the cursor to where we were.
	() = locate_header_by_msgid (previous_message_id, 0);
     }
   else
     {
	% The article at the cursor has no parent article in the header list.
	% This means either the current article has no logical parent or the
	% current article's parent article is not in the header list.  Since
	% you didn't distinguish between these two states in your article (to
	% my understanding), I figured this distinction didn't really matter
	% for your purposes.
     }
#v-

is one quick way to check for parent articles without moving the cursor.

Happy newsreading.
Technical Details
Message-ID: <slrn943hbu.8v.jbn@next.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.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!news.shout.net!jbn
References: <0ruq19.1q3.ln@127.0.0.1> <slrn9430e5.8v.jbn@next.forestfield.org> <n47s19.4d4.ln@127.0.0.1>

Show Full Headers
Complete Article Headers
Message-ID: <slrn943hbu.8v.jbn@next.forestfield.org>
Subject: Re: [slrn] thread_size() & single article
Date: Thu, 21 Dec 2000 08:56:46 +0000
From: jbn@forestfield.org (J.B. Nicholson-Owens)
References: <0ruq19.1q3.ln@127.0.0.1> <slrn9430e5.8v.jbn@next.forestfield.org> <n47s19.4d4.ln@127.0.0.1>
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-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!news.shout.net!jbn
Newsgroups: news.software.readers
Organization: Forest Field OmniMedia
Lines: 104
NNTP-Posting-Host: forestfield.org
X-Trace: roundup.shout.net 977389006 4056 208.216.67.173 (21 Dec 2000 08:56:46 GMT)
X-Complaints-To: abuse@shout.net
NNTP-Posting-Date: 21 Dec 2000 08:56:46 GMT
User-Agent: slrn/0.9.6.4 (Unix)