Article View: news.software.readers
Article #139246Re: [Dialog] Kill Followup Script
From: paul j.
Date: Sun, 14 Dec 2003 00:06
Date: Sun, 14 Dec 2003 00:06
141 lines
6973 bytes
6973 bytes
On Fri, 12 Dec 2003 23:27:07 +0000, JoeB wrote: > Hi all. > > Please find attached my first attempt at Dialog scripting. (Please don't > laugh.) > > In certain groups, a perfectly normal thread will be going on, until a > well-known troll posts a response. From that point on the thread > degenerates into ad hominems and a tedious slanging match. I have no > interest in the thread from that point: this script is intended to address > that. > > What the script does is check each message's author against a (user > defined) list of posters. If the posting is from one such, the message id > is compared against a list of already-banned ids, and added if it does not > already exist: the message is then killed. > > Each message's references are then checked against the banned ids, and if > they contain the id, the message is again killed. > > The practical upshot is to kill all posts, and followups to those posts, by > particular authors, without nuking the whole thread. > > Now the disclaimers: I'm very new to Dialog and Pascal - I heard about it a > week ago - and I'm no programmer. The script is basically a Lego job, > bolted together from concepts lifted wholesale from the existing body of > Dialog scripts. I realise that the script is crude, and could do with > improvement: to that end I would be delighted for any input the more > skilled regulars could provide... the more the merrier :-) > > Usage: > > 1) Create two blank text files as defined in the Const section. > 2) Cut and paste the *entire* From: line into the killauth text file. (The > whole string - for example "RandomTroll" <randomtroll@foo.org> - is > required, not just the nickname. > 3) Assign the script below to the OnXOver event, compile, run and save. > > <script starts> > > program OnXover; > // OnXover script to identify and kill posts by banned authors, and > followups to > // those posts > > // set these variables as the paths to the working files - create empty > text files in these locations > const > KillAuthFile = 'c:\killauth.txt'; // file of Froms to kill - must contain > full string, not just name > KillMsgIdFile = 'c:\killmsg.txt'; // autogenerated file of msgids to kill > > function CheckAuth(AuthName : string): boolean; > // check if author is to be killed > VAR > AuthList : TStringList; > begin > AuthList := TStringList.Create(); > Authlist.LoadFromFile(KillAuthFile); > Result := authlist.indexof(AuthName) > -1 > AuthList.free; > end; > > function CheckKnownId(KnownId : string): boolean; > // check to see if we already knowthis msgid so we don't add it again > VAR > KnownIdList : TStringList; > begin > KnownIdList := TStringList.Create(); > KnownIdlist.LoadFromFile(KillMsgIdFile); > Result := KnownIdlist.indexof(KnownId) > -1 > KnownIdList.free; > end; > > procedure AddNewId(NewId: string); > // add a new msgid to the kill list > VAR > IdList: TStringList; > begin > IdList := TStringList.Create(); > IdList.LoadFromFile(KillMsgIdFile); > IdList.Add(NewId); > IdList.SaveToFile(KillMsgIdFile); > IdList.Free; > end; > > > > procedure OnXover(Var XoverData:TXoverData); > var > Msglist: TStringList; > n: integer; > begin // check to see if we kill this author > if checkauth(xoverdata.from) then > // if we do, check to see if this is a new msgid > begin > if not checkknownid(xoverdata.msgid) then // if it's new, add it > addnewid(xoverdata.msgid); > xoverdata.deleted := true; // and kill the parent article > end; > // if it's not a killed author, check to see if it's a followup > msglist := TStringList.Create(); > msglist.LoadFromFile(KillMsgIdFile); > for n := 0 to msglist.count - 1 do > begin > IF pos(msglist[n],XoverData.References)>0 > THEN xoverdata.deleted := true; // and kill the followup > end > msglist.free; > end; > > begin > end. > > <script ends> > > Things I think that are wrong with the script: > 1) There's probably a setting in Dialog to do exactly this already :-) > 2) The whole From: string is required, which does not handle morphs very > well. But I can't figure out how to get the NNTP-Posting-Host from the > initial OnXOver event. Or maybe some sort of regex? > 3) I've no idea what impact it has on performance when downloading headers. > 4) I believe I should have used try/finally contructions, but I couldn't > get the syntax right. > 5) The KillMsgIdFile will probably have to be cleared out periodically. > 6) Some poster's newsreaders appear to mangle the References: header, so > the script is not 100% effective. But it helps :-) > > Hope this is of use to some people, and, as I said, I would greatly > appreciate any comments that would improve (a) the script and (b) my > scripting. > > JoeB So this will basically kill followups to people I deem unworthy of reading? :) -- Before you open your mouth to speak, please make sure it's an improvement upon the silence. -----= check my headers for valid email address =-----
Technical Details
Message-ID:
<1atfrm4uog72w.dlg@soxnews.shacknet.nu>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!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed1.easynews.com!easynews.com!easynews!easynews-local!news.easynews.com.POSTED!not-for-mailReferences:
<acvkac1u7d89.1ovm1kafvs4m9$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Message-ID: <1atfrm4uog72w.dlg@soxnews.shacknet.nu>
Subject: Re: [Dialog] Kill Followup Script
Date: Sun, 14 Dec 2003 00:06:56 GMT
From: "paul j." <nothanks@mungedfake.com>
References: <acvkac1u7d89.1ovm1kafvs4m9$.dlg@40tude.net>
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!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed1.easynews.com!easynews.com!easynews!easynews-local!news.easynews.com.POSTED!not-for-mail
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.8.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Baseball: Redsox
X-Email: gdfan at comcast dot net
X-Face: s`q4iP#W;
*'Wb4mai6$!6N9)s`Y80RqKIn!U4]_ntOT0OT3%oagwO?pl{8iL4J:cRBPRa=`0qY2)I
X-Football: Patriots
X-Humor: I'll tell you what,
you can get a good look at a t-bone by sticking your head up a bull's
ass, but I'd rather take the butcher's word for it.
X-No-Archive: yes
X-Truth: You are not special. You are not a beautiful or unique snowflake. You
are the same decaying organic matter as everything else.
X-Wise: R2D2, you know better than to trust a strange computer
Lines: 141
X-Complaints-To: abuse@easynews.com
Organization: EasyNews, UseNet made Easy!
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise
we will be unable to process your complaint properly.