🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #234889

My dysfunctional attemp

#234889
From: ShadowTek
Date: Sat, 01 Aug 2009 19:44
187 lines
8359 bytes
On 2009-07-31, John E. Davis <jed@jedsoft.org> wrote:
>
> Here is a version that deals directly with the scorefile and should be
> a bit faster.  --John

That means that the original post can't be killed, right?

I was trying to build my own script, but I couldn't find any way to do it
that would allow me to kill the original post, since it needed to be
visible for its Message-ID to be read.

Anyway, I was building my own script that made use of a seprerate file
to store the From and Message-ID headers, and everything seemed to be
working great towards the end, but then it started failing to apply
itself to all threads correctly. It's a shame, since it seemed like it was working
perfectly there for a while. I m not sure if I screwed something up
towards the end, or I had simply been missing something all along, but
either way, I'm tired of screwing with it.

I'll go ahead and post my last version of it in case anyone can or wants
to do anything with it.

Remember, *this version is NOT working properly*.

Contents of slrn_superplonk.sl:
#v+

% Last updated: 2009/07/31

%% Summary %%

% The purpose of this script is to provide a way to identify  and score
% all posts by and followups to
% a particular individual.

%% Installation Instructions %%

% Add the following lines to slrnrc, and change the "user" part of the
% path of slrn_superplonk.sl to your home directory.
%	interpret "/home/user/slrn_superplonk.sl"
%	setkey article "superplonk" "^k"

%% Usage Notes %%

% When viewing an article that is posted by a person that you want to
% SuperPlonk, press "Control K" to add thier
% From header to $HOME/superplonk_from.txt. That file will be used each
% time you enter a group to check all 
% From headers and add the Message-ID of each matching header to
% $HOME/superplonk_mid.txt. That file will then be
% used to scan all headers when entering a group. If headers with a
% matching Message-ID are found, they are marked
% read, and expunged by default (that can be changed if you prefer to
% leave them visible).

% Default behavior is to exit the current group once someone has been
% SuperPlonked, since re-entering the group is
% needed for the chenges to take effect, but this can be disable by
% commenting it out below.

% SuperPlonk will also add the poster's From header to the scorefile,
% and assign it a score of -9000. The can also be changed
% below. Also, this script depends on being able to see all headers, so
% it won't work on anyone who has a score of -9999.
% Since the default behavior of this script is already set to
% automatically expunge all low-score headers when
% entering a group, it will serve as a sort of killfill for them anyway.
% This auto-expunging can be commented out below.

% $HOME/slrn_superplonk_from.txt and $HOME/slrn_superplonk_mid.txt will
% both be created automatically, and
% can be deleted at any time.

% I'm not how big *mid.txt would have to get before it would cause any
% noticible system lag, but you can
% just delete it if it does. All the stored From headers are in
% *from.txt, so *mid.txt will just start rebuilding
% again automatically as you download more headers.

define check_mid ()
{
	variable home_str;
        variable home_file = popen ("echo $HOME", "r");
        () = fgets (&home_str, home_file);
        () = pclose (home_file);
	home_str = substr (home_str, 1, (strlen (home_str)) - 1);
	variable mid_file  = fopen (home_str+"/slrn_superplonk_mid.txt",
"a+");
	() = fclose (mid_file);
	mid_file = fopen (home_str+"/slrn_superplonk_mid.txt", "r");
	variable line_str = fgetslines (mid_file);
	() = fclose (mid_file);
	variable line_total = length (line_str);
	if (line_total == 0) return;
	variable line_current;
	while (header_up(1)){}
	do
	{
		line_current = 1;
		variable ref_hdr = extract_article_header
("References");
		while (line_current <= line_total) {
				if (ref_hdr, is_substr (substr
(line_str[line_current -1], 13, strlen (line_str[line_current - 1]) -
13)) != 0 ) {
					set_header_flags(get_header_flags()
| HEADER_READ);
				}
			line_current = line_current + 1;
		}
	} while (header_down(1));
	return;
}

define check_from ()
{
	variable home_str;
        variable home_file = popen ("echo $HOME", "r");
        () = fgets (&home_str, home_file);
        () = pclose (home_file);
	home_str = substr (home_str, 1, (strlen (home_str)) - 1);
	variable from_file  = fopen
(home_str+"/slrn_superplonk_from.txt", "a+");
	() = fclose (from_file);
	from_file = fopen (home_str+"/slrn_superplonk_from.txt", "r");
	variable line_str = fgetslines (from_file);
	() = fclose (from_file);
	variable line_total = length (line_str);
	if (line_total == 0) {
		check_mid();
		return;}
	variable line_current = 1;
	while (header_up(1)){}
	do
	{
		while (line_current <= line_total) {
				if (substr (line_str[line_current -1],
13, strlen (line_str[line_current - 1]) - 13) == extract_article_header
("From")) {
 				variable mid_file = fopen
(home_str+"/slrn_superplonk_mid.txt", "a+");
 				() = fputs (strftime ("%Y/%m/%d")+"
"+extract_article_header ("Message-ID")+"\n", mid_file);
 				() = fclose (mid_file);
				}
			line_current = line_current + 1;
		}
		line_current = 1;
	} while (header_down(1));
	check_mid();
	return;
}

define superplonk ()
{
	variable home_str;
        variable home_file = popen ("echo $HOME", "r");
        () = fgets (&home_str, home_file);
        () = pclose (home_file);
        variable from_file = fopen (substr (home_str, 1, ((strlen
(home_str)) - 1))+"/slrn_superplonk_from.txt", "a+");
	variable from_field = extract_displayed_article_header ("From");
	%if (read_mini ("SuperPlonk "+from_field+" ? y/n  ", "n", "") ==
	%"y") {
	if (get_yes_no_cancel ("SuperPlonk "+from_field+" ?") == 1) {
		() = fputs (strftime ("%Y/%m/%d")+"  "+from_field+"\n",
from_file);
		set_input_string ("-9000\n+9999"); % Change these to
affect score results. (score/days-to-expire)
		set_input_chars ("fan");
		call ("create_score");
		call ("quit"); % Comment out this line to disable
auto-apply of SuperPlonk while in article mode.
		message (from_field+" has been SuperPlonked");
 		}
		else message ("Action cancelled.");
	() = fclose (from_file);
	return;
}

() = register_hook ("article_mode_hook", "check_from");

#v-

Preferably, a working version of this would be able to do the job *and*
"kill" the affected posts, including the one with the original
Message-ID.
Technical Details
Message-ID: <slrnh796ag.n0g.ShadowTek@desktop.localdomain>
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!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!not-for-mail
References: <guhtt9$82j$1@news.motzarella.org> <slrnh0p4lk.9q2.catwheezel@ID-107770.user.individual.net> <slrnh6sm2b.be4.ShadowTek@desktop.localdomain> <20090729080451@usenet.piggo.com> <slrnh6v215.m8d.ShadowTek@desktop.localdomain> <20090729101510@usenet.piggo.com> <slrnh6vnoo.8ce.ShadowTek@desktop.localdomain> <slrnh73i74.imu.jed@aluche.mit.edu> <20090731083455@usenet.piggo.com> <slrnh749g4.qr1.usenet@news.piggo.com> <slrnh74t48.4ch.jed@aluche.mit.edu> <20090731235846@usenet.piggo.com> <slrnh769m0.nk4.jed@aluche.mit.edu>

Show Full Headers
Complete Article Headers
Message-ID: <slrnh796ag.n0g.ShadowTek@desktop.localdomain>
Subject: My dysfunctional attemp
Date: Sat, 01 Aug 2009 19:44:12 +0000
From: ShadowTek <ShadowTek@invalid.invalid>
References: <guhtt9$82j$1@news.motzarella.org> <slrnh0p4lk.9q2.catwheezel@ID-107770.user.individual.net> <slrnh6sm2b.be4.ShadowTek@desktop.localdomain> <20090729080451@usenet.piggo.com> <slrnh6v215.m8d.ShadowTek@desktop.localdomain> <20090729101510@usenet.piggo.com> <slrnh6vnoo.8ce.ShadowTek@desktop.localdomain> <slrnh73i74.imu.jed@aluche.mit.edu> <20090731083455@usenet.piggo.com> <slrnh749g4.qr1.usenet@news.piggo.com> <slrnh74t48.4ch.jed@aluche.mit.edu> <20090731235846@usenet.piggo.com> <slrnh769m0.nk4.jed@aluche.mit.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.20140922.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!not-for-mail
Newsgroups: news.software.readers
Organization: A noiseless patient Spider
Lines: 187
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org
 U2FsdGVkX19VwLkA60PYIA0F2Qch0V1pRQ38fwkSgWfjfv1AZ/MZ3zcxOOqTS3QmBXHNyOfW18KYekpsziGb2ax+3cD5/fjHunhrr5C0egvxncKPVWX8b4/A+PvllhM5k15Wjt/XRT18G8UJ6p4YZQ==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sat, 1 Aug 2009 19:44:12 +0000 (UTC)
X-Auth-Sender: U2FsdGVkX19ad63cxLEdFa4aFtc2oP9xk1RVIIkPfKWJ+kKaFFR6Cg==
Cancel-Lock: sha1:jNUphMy9mNIYXFNgL4rSnRAlp94=
User-Agent: slrn/pre1.0.0-2 (Linux)