🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #44047

Re: [slrn] Making already-read crosspostings completely un-read.

#44047
From: blue... Dawn Owens-Nicholson
Date: Mon, 26 Oct 1998 00:00
115 lines
4598 bytes
Martin Ramsch wrote:
> Now, if I do an 'u' to make such an article un-read again, it is only
> marked unread in this single newsgroup, which I'm currently reading.

I haven't verified this to be true in the latest slrn, but such behavior
sounds like a bug to me.  In my opinion, either an article is read or
unread; until it's read in one group, it should remain unread in all
crossposted groups.

> Is there a way to mark an article unread in all of it's newsgroups at
> once?  (Besides visting all of these groups and do it step by step ...)

Here's one way to do it with slrn hooks: If your server supports Xref:, you
could make a macro to run when you leave a newsgroup with
article_mode_quit_hook().  This macro would go over each unread crossposted
article in the header list and store the {newsgroup/article number} pair in
a global linked list.  A second macro, an article_mode_hook() macro, would
scan this linked list on group entry and add the appropriate articles to the
header list then mark them unread.  The main problem is keeping the linked
list short--there should be some way to remove read articles from the linked
list.  Given I think this is a bug, I'd consider this a workaround.

The code below might come in handy.  Hope this helps!

   % Author: J.B. Nicholson-Owens

   !if (is_defined ("unmark_crossposts"))
      variable unmark_crossposts = NULL;

   define unmark_crossposts_article_mode_quit_hook ()
   {
      variable sorting_method = get_variable_value ("sorting_method");

      set_integer_variable ("sorting_method", 0);
      call ("header_bob");
      do
	{
	   !if (get_header_flags () & HEADER_READ) continue;

	   variable
	     xref = extract_article_header ("Xref"),
	     element = "",
	     index = 0,
	     new = NULL,
	     position = 0,
	     length = 0;

	   !if (strlen (xref)) continue;
	   if (string_match (xref, "^\([^:] ?\)\(.*\)", 1))
	     {
		(position, ) = string_match_nth (2);
		xref = substr (xref, position + 1, -1);
	     }

	   while (element = extract_element (xref, index, ' '),
		  element != NULL)
	     {
		% parse the element into newsgroup:article_number
		
		!if (string_match (element, "\([^:]*\):\(.*\)", 1)) continue;
		new = struct { newsgroup, article_number, next };
		(position, length) = string_match_nth (1);
		new.newsgroup = substr (element, position + 1, length);
		(position, length) = string_match_nth (2);
		new.article_number = substr (element, position + 1, length);

		if (unmark_crossposts == NULL)
		  {
		     unmark_crossposts = new;
		     unmark_crossposts.next = NULL;
		  }
		else new.next = unmark_crossposts;
	     }
	}
      while (header_down (1));

      set_integer_variable ("sorting_method", sorting_method);
   }

   define unmark_crossposts_article_mode_hook ()
   {
      if (unread_crossposts == NULL) return ();  % nothing in the list

      variable
	newsgroup = current_newsgroup (),
	lp = unread_crossposts,                  % a list pointer
        prev = NULL,                             % so we can remove a node
        articles_added = 0;                      % number of articles added

      while (lp != NULL)
	{
	   if (lp.newsgroup == newsgroup)
	     {
		set_input_string (lp.article_number);
		call ("goto_article");           % move cursor to article
		call ("undelete");               % make article unread

		if (lp == unread_crossposts)     % delete the node
		  unread_crossposts = unread_crossposts.next;
		else prev.next = lp.next;

		articles_added++;
	     }
	   
	   prev = lp;
	   lp = lp.next;
	}
      
      % might need to resort the header list, in case goto_article added
      % the new articles in an unsorted order.
      if (article_added)
	set_integer_variable (get_variable_value ("sorting_method"));
   }
Technical Details
Message-ID: <slrn737jsg.2sl.bluemoon@ux6.cso.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
References: <slrn6tn1iu.25k.ljz@sunspot.tiac.net> <slrn736t9g.8c3.m.ramsch@melian.forwiss.uni-passau.de>

Show Full Headers
Complete Article Headers
Message-ID: <slrn737jsg.2sl.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: [slrn] Making already-read crosspostings completely un-read.
Date: Mon, 26 Oct 1998 00:00:00 +0000
From: blue...@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <slrn6tn1iu.25k.ljz@sunspot.tiac.net> <slrn736t9g.8c3.m.ramsch@melian.forwiss.uni-passau.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
X-Deja-AN: 405034110
Organization: University of Illinois at Urbana-Champaign
User-Agent: slrn/0.9.5.3 (UNIX)
Newsgroups: news.software.readers,alt.lang.s-lang