🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #241805

Re: [slrn] True offline mode

#241805
From: ernobe
Date: Thu, 22 Jul 2010 17:50
221 lines
9338 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");
>             			
I finally got it to do what I thought was meant by "true offline mode".  In 
the following setup, threads that have any unread articles are 
reconstructed every time you enter the group, as long as the original post of 
the thread is marked read.  If it isn't the articles within the thread that 
are marked read will not be reconstructed as part of the thread ever again.  
If the whole thread is deleted but a score had been set to retrieve the body 
of a reply, it will cause the whole thread to be reconstructed.  


    define make_clean_threads ()
    {
	variable amd, dma, hhh, list;
	list = {};
        call ("header_bob");
        do
          {
             if (not ("" == extract_article_header ("References"))) 
             {
                if (1 == get_body_status ()) 
                {
            	    call ("delete");
            	    header_up (1);
            	}
            	else 
            	{
            	    amd = extract_article_header ("Message-ID"); 
            	    list_insert (list, amd);
            	}
             }
          }
        while (header_down (1));
        call ("expunge");
	hhh = length (list);
        while (hhh)
          {
	     hhh--;
	     dma = list_pop(list);
	     () = locate_header_by_msgid (dma,0);
            	    set_prefix_argument (2);
            	    call ("get_parent_header");
		    collapse_thread ();
          }
    }
    () = 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: <i2a0cr$oqc$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.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!newsfeed.straub-nv.de!open-news-network.org!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> <i260r3$t2b$1@news.eternal-september.org>

Show Full Headers
Complete Article Headers
Message-ID: <i2a0cr$oqc$1@news.eternal-september.org>
Subject: Re: [slrn] True offline mode
Date: Thu, 22 Jul 2010 17:50:19 +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> <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.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!newsfeed.straub-nv.de!open-news-network.org!eternal-september.org!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: Baha'i Faith
Lines: 221
Injection-Date: Thu, 22 Jul 2010 17:50:19 +0000 (UTC)
Injection-Info: mx02.eternal-september.org;
 posting-host="JELnH+BdEro/urHfghrQkg";
 logging-data="25420"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX18DUVt7uOgLeibPpkOX25kl9voVbKrWWNw="
User-Agent: slrn/pre1.0.0-18 (Linux)
Cancel-Lock: sha1:jXpkPHS4oV4XqYS55JP+XHwy5jc=