Article View: news.software.readers
Article #169102Re: [Dialog] Delete trolls + replies #2
From: Korbinian Abenthum
Date: Mon, 11 Jul 2005 17:07
Date: Mon, 11 Jul 2005 17:07
76 lines
3748 bytes
3748 bytes
Bertel Lund Hansen wrote:
> Korbinian Abenthum skrev:
>> Well you can, if you use an OBSaving script that inserts a header if the
>> first line of the body contains "NameOfTheTroll".
> Could you show me such a script or just hint as to how to write
> it?
There already is a bodyscoring script in the Wiki which inserts a header if
a certain keyword is found in the body:
http://www.40tude.com/DIALOG/wiki/index.php/DeleteTOFU_and_do_BodyScoring
That one's pretty huge, though, and it tries to find it in the complete
body, which would provoke the problems you mentioned.
> I wouldn't use it, but I'd like to know.
Basically it's very easy: Just walk through the lines of the article using
the message.strings array.
Like so:
| program OnBeforeSavingMessage;
|
| const NUMBER_OF_ATTRIBUTION_LINES_TO_SCAN = 1;
|
| procedure BodyscoreTrolls( var message :TStringlist;
| const servername :string;
| const isEmail :boolean);
| var i : integer;
| firstBodyLine : integer;
|
| begin
|
| if message.Count<=0 then exit;
|
| // Find the end of the header
| i := 0;
| while (message.strings[i]<>'') do begin
| i := i + 1;
| end;
| firstBodyLine := i+1;
|
| // Scan the first NUMBER_OF_ATTRIBUTION_LINES_TO_SCAN lines in the body
| // for a keyword
| for i:=1 to NUMBER_OF_ATTRIBUTION_LINES_TO_SCAN do begin
|
| // Replace NameOfTheTroll with the keyword you're looking for
| if (AnsiPos(message.strings[i], 'NameOfTheTroll')>0) then begin
| message.insert(0, 'X-Troll-Reply: NameOfTheTroll');
| exit;
| end;
| end;
| end;
|
| procedure OnBeforeSavingMessage(
| var Message : TStringlist;
| const Servername : string;
| const IsEmail : boolean
| );
|
| begin
| BodyscoreAttributionLines(Message, Servername, IsEmail );
| end;
|
| begin
| end.
Should work if you compile that as your OnBeforeSaving-Script.
To score on it, use
| !delete Header {^X-Troll-Reply: }
Note that you need to retrieve the body before you can delete it!
--
"Rhaegar fought valiantly, Rhaegar fought nobly, Rhaegar fought honorably.
And Rhaegar died." (Jorah Mormont)
Technical Details
Message-ID:
<110705.190734.nsr.25@news.abenthum.de>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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mailReferences:
<ejaxb4cn2e9c$.15sezvt42tatt$.dlg@40tude.net> <grbrs2s2jyyj$.1h3ptddjohie5$.dlg@40tude.net> <110705.163036.nsr.23@news.abenthum.de> <jgkr8wn2ygy8.5alsgazifs21$.dlg@40tude.net>Show Full Headers
Complete Article Headers
Message-ID: <110705.190734.nsr.25@news.abenthum.de>
Subject: Re: [Dialog] Delete trolls + replies #2
Date: Mon, 11 Jul 2005 19:07:34 +0200
From: Korbinian Abenthum <korbinian@gmx.de>
References: <ejaxb4cn2e9c$.15sezvt42tatt$.dlg@40tude.net> <grbrs2s2jyyj$.1h3ptddjohie5$.dlg@40tude.net> <110705.163036.nsr.23@news.abenthum.de> <jgkr8wn2ygy8.5alsgazifs21$.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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail
Newsgroups: news.software.readers
Organization: T-Online
Lines: 76
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.t-online.com 1121101668 05 17480 CwFsJsTv9zXvSLmm 050711 17:07:48
X-Complaints-To: usenet-abuse@t-online.de
X-ID: JOmC+QZLYetkf7vhbfISjHdUfBUFKQ4wWJmpME5iZB7I8gk8vKg0ZK
X-Now-Playing: The Troggs - Wild Thing
User-Agent: 40tude_Dialog/2.0.15.1 Hamster/2.0.6.0
X-Face: &[gF$*:|'M7pwKut]{LOz!&65BT96:Wn\M"V6Qa#q%~9^z8XhJfmh?.)VB{,
p]Z`6q@e()! g1ghrG7.atG.DXfzulkKE%u~|D7?e6^-yN4GvZJuvz%$LZBA6`dJTo,
MYUO%I*0us[.v/AT,