🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #241787

Re: [slrn] True offline mode

#241787
From: ernobe
Date: Wed, 21 Jul 2010 05:33
155 lines
6958 bytes
>
>>
>>>> when I set sorting_method to 12 ( custom ), custom_sort_by_threads to 1 ( 
>>>> do threading ), and put bodies first ( rather bodiless first ) in 
>>>> custom_sort_order, I'm left with header only threads and individual messages 
>>>> first, before the threads with bodies.  What I'd like it do is apply a score 
>>>> so that subjects beginning with Re: that appear in the first, header only 
>>>> section are killed.  But it doesn't seem possible, because if I kill such 
>>>> subjects it will kill them all, including the ones in threads that already 
>>>> have articles with bodies.  In other words, I'd like to see only new subject 
>>>> messages or threads in the header only section.
>>>>
>>> The following could work if all article subjects beginning with Re: had a 
>>> parent on the server.Could someone tell me why it doesn't delete the articles 
>>> that have a parent, please?
>>>  
>>>     define make_clean_threads ()
>>>     {
>>>         call ("header_bob");
>>>         do
>>>           {
>>>              if (1 == has_parent ()) call ("delete_thread");
>>>           }
>>>         while (header_down (1));
>>>     }
>>>     () = register_hook ("article_mode_startup_hook",
>>> 			"make_clean_threads" );
>>
>> This does it:
>>
>>     define make_clean_threads ()
>>     {
>>         call ("header_bob");
>>         do
>>           {
>>              if (not ("" == extract_article_header ("References"))) 
>> 		{ 
>> 			call ("delete");
>>              		header_up (1); 
>> 		}
>>           }
>>         while (header_down (1));
>>         call ("expunge");
>>     }
>>     () = register_hook ("article_mode_startup_hook",
>> 			"make_clean_threads" );
>> 			
>>
>> For some reason, call ("delete"); moves the cursor down to the next header, so 
>> it is necessary to call header_up (1) after it.  This code does not delete any 
>> messages that don't have a references line, after threading ( so it does not 
>> affect their "children" ), so hopefully all that is left are new subject 
>> messages or threads.  Will have to see if there is a problem with replies to 
>> messages that don't have a references line, and what to do with them.
>>   
> For the sake of completeness here is how the macro currently stands:
>
>
>     define make_clean_threads ()
>     {
>         call ("header_bob");
>         do
>           {
>              if (not ("" == extract_article_header ("References"))) 
>              {
>                 if (0 == get_body_status ()) set_header_flags (HEADER_TAGGED);
>                 else 
>                 { 
>             	    call ("delete");
>             	    continue; 
>             	}
>             }
>           }
>         while (header_down (1));
>         call ("expunge");
>     }
>     () = register_hook ("article_mode_startup_hook",
> 			"make_clean_threads" );
> 			
>     define post_filter_hook (file)
>     {	
> 	variable cmd = "mycont";
> 	() = system (sprintf ("%s '%s'", cmd, file));
>     }
>
> 			
> All this saves me from using two other macros, stickytags and one-key-stroke, 
> the only ones I had been using ( beside get-by-mid which didn't seem to work). 
> Here's how it works: the post filter hook calls a program that creates a 
> score in the slrnpull scorefile that will download the bodies of replies to 
> the article posted, which the make_clean_threads function will tag instead of 
> deleting.  No need for stickytags or in fact no need to use scoring in slrn 
> with or without one-key-stroke, because the articles get tagged instead of 
> scored.  Unfortunately, I don't generate my own message-ids, ( I just found 
> out by trying to post this article, that the filter mechanism writes to the 
> scorefile but does not include the message-id ) so I will have to figure out a 
> way to get the information from my saved-posts file, since the server provides 
> a message-id, but too late to be used with the filter hook.  Is there a way to 
> use the post_hook function to get the message-id supplied by the server?
>

I've devised a work-around for not having the message-id.  It uses the idea of 
separate files for each post mentioned in another thread.  The continue; 
function in the example above didn't work as expected, and so I reverted to 
header_up.  Instead of filtering and then posting, I will now try posting and 
then pressing the "8" key to have my program write the score to the slrnpull 
scorefile. 

    define make_clean_threads ()
    {
        call ("header_bob");
        do
          {
             if (not ("" == extract_article_header ("References"))) 
             {
                if (0 == get_body_status ()) set_header_flags (HEADER_TAGGED);
                else 
                { 
            	    call ("delete");
            	    header_up (1); 
            	}
            }
          }
        while (header_down (1));
        call ("expunge");
    }
    () = register_hook ("article_mode_startup_hook",
			"make_clean_threads" );
			
    define mycont_prog ()
    {	
	variable cmd = "mycont";
	variable mdo = get_variable_value("save_posts");
	() = system (sprintf ("%s '%s'", cmd, mdo));
    }

    define fudge_save_file ()
    { 
	variable tm = localtime (_time ());
	set_string_variable ("save_posts", 
	    sprintf ("/home/roy/News/sent/%d%02d%02d-%02d%02d%02d.news",
		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
		tm.tm_hour, tm.tm_min, tm.tm_sec ));
    }
    () = register_hook ("post_file_hook", "fudge_save_file");

    definekey ("mycont_prog", "8", "article");
            			


-- 
"The world of existence is an emanation of the merciful attribute of God."
Abdu'l-Baha
http://www.costarricense.cr/pagina/ernobe
Technical Details
Message-ID: <i260r3$t2b$1@news.eternal-september.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.20140922.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!eternal-september.org!.POSTED!not-for-mail
References: <i1fnkv$c3i$1@news.eternal-september.org> <i22han$4uk$1@news.eternal-september.org> <i22vbu$qm4$1@news.eternal-september.org> <i2591a$4v0$1@news.eternal-september.org>

Show Full Headers
Complete Article Headers
Message-ID: <i260r3$t2b$1@news.eternal-september.org>
Subject: Re: [slrn] True offline mode
Date: Wed, 21 Jul 2010 05:33:24 +0000
From: ernobe <ernobe@yahoo.com>
References: <i1fnkv$c3i$1@news.eternal-september.org> <i22han$4uk$1@news.eternal-september.org> <i22vbu$qm4$1@news.eternal-september.org> <i2591a$4v0$1@news.eternal-september.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.20140922.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!eternal-september.org!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: Baha'i Faith
Lines: 155
Injection-Date: Wed, 21 Jul 2010 05:33:24 +0000 (UTC)
Injection-Info: mx01.eternal-september.org;
 posting-host="JELnH+BdEro/urHfghrQkg";
 logging-data="29771"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX1+PCFwupNrLFf6rgeHiQFvBNj3uCRT9ik8="
User-Agent: slrn/pre1.0.0-18 (Linux)
Cancel-Lock: sha1:K1vXVeBGpWmkjAJrU9boVSrqqdI=