Article View: news.software.readers
Article #42876Re: SLRN - score/kill while checking groups?
From: Dawn Owens-Nicholson
Date: Sun, 23 Aug 1998 00:00
Date: Sun, 23 Aug 1998 00:00
98 lines
4799 bytes
4799 bytes
[I posted <slrn6tun2t.6s9.bluemoon@ux6.cso.uiuc.edu> and (of course,
afterwards) thought of a rare situation that is easy to account for which
might cause this macro to do the wrong thing. This article supersedes the
one listed above. The second macro, basic_display_true_counts(), and the
text are unmodified.]
Dan Birchall <djb@scream.org> wrote:
> [...] but is there a way (maybe in s-lang?) to make SLRN slurp all the new
> message headers, score/kill them based on the .score file, and *then*
> display the remaining groups and message counts?
Yes. Keeping in mind all the caveats you mentioned, and that you didn't
mention whether you wanted to score headers for subscribed or unsubscribed
groups, groups matching a regex (or regexes), etc...you could use this which
will score all groups listed in group mode:
define display_true_counts ()
{
variable
was_in_group_mode = is_group_mode (), % were we in group mode?
message_ID = "", % article where we began
article_was_visible = 0, % was the article visible?
sort_method = 0,
collapsed = 0, % beginning thread collapse
group = current_newsgroup (); % newsgroup where we began
!if (was_in_group_mode) % record article mode stuff
{
message_ID = extract_article_header ("Message-ID");
article_was_visible = is_article_visible ();
sort_method = get_variable_value ("sorting_method");
collapsed = is_thread_collapsed ();
call ("quit"); % get to group mode
}
EXIT_BLOCK
{
while (current_newsgroup () != group) % get back to where we began
() = group_search (group);
if (was_in_group_mode) return ();
call ("select_group"); % enter newsgroup
set_integer_variable ("sorting_method", sort_method);
set_input_string (message_ID); % go to the original header
call ("locate_header_by_msgid"); % (possibly downloading it!)
if (extract_article_header ("Message-ID") != message_ID) return ();
if (article_was_visible == 1) % restore article mode screen
call ("scroll_dn");
if (collapsed) collapse_thread ();
}
call ("bob"); % jump to the top group
if (current_newsgroup () == "") % nothing to do
error ("No newsgroups listed!");
do
{
ERROR_BLOCK { _clear_error (); } % if all articles are killed
!if (select_group ()) call ("quit"); % enter, score & leave group
}
while (group_down_n (1)); % go to next newsgroup
}
In case the commenting wasn't enough, here's a basic version that makes no
attempt to restore your slrn screen (it will either error or leave you in
group mode at the last group in your group list):
define basic_display_true_counts ()
{
!if (is_group_mode ()) call ("quit"); % get to group mode
call ("bob"); % jump to the top group
if (current_newsgroup () == "") % nothing to do
error ("No newsgroups listed!");
do
{
ERROR_BLOCK { _clear_error (); } % if all articles are killed
!if (select_group ()) call ("quit"); % enter, score & leave group
}
while (group_down_n (1)); % go to next newsgroup
}
One last tricky situation you might not have planned on: article marked as
read and articles killed are effectively *the same thing* when you enter
(score) and leave a newsgroup. This is because articles neither marked read
nor killed articles will appear when you enter the group next time. I made
an exception in the first macro for the article at the cursor when you run
display_true_counts() (unless that article has been removed from your
server, that article will reappear at the cursor when the macro is done).
I leave a bunch of enhancements as exercises for the reader.
Technical Details
Message-ID:
<slrn6tuoup.6s9.bluemoon@ux6.cso.uiuc.edu>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!not-for-mailReferences:
<slrn6ttp4b.c6.djb@versa.scream.org> <slrn6tun2t.6s9.bluemoon@ux6.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Message-ID: <slrn6tuoup.6s9.bluemoon@ux6.cso.uiuc.edu> Subject: Re: SLRN - score/kill while checking groups? Date: Sun, 23 Aug 1998 00:00:00 +0000 From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson) References: <slrn6ttp4b.c6.djb@versa.scream.org> <slrn6tun2t.6s9.bluemoon@ux6.cso.uiuc.edu> 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!not-for-mail X-Deja-AN: 383776955 Supersedes: <slrn6tun2t.6s9.bluemoon@ux6.cso.uiuc.edu> Organization: University of Illinois at Urbana-Champaign Newsgroups: news.software.readers