🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #248477

Re: Q.: Dialog and X-Face display ... ?

#248477
From: VanguardLH
Date: Wed, 25 Jan 2012 19:45
73 lines
4864 bytes
Bernd Rose wrote:

> program OnBeforeSavingMessage;
> // *Remove X-Face from incoming messages*
> // Code needs to be inserted in a newly created 
> // or modified OnBeforeSaving Event Script
> 
> procedure OnBeforeSavingMessage(var Message: TStringlist; Servername: string; IsEmail: boolean);
> var i : Integer;
> begin
>   i := 0;
>   repeat
>     if Pos('X-Face: ', Message[i]) = 1 Then
>       repeat
>         Message.delete(i); 
>       until (Message[i][1] > ' ') or (Message[i] = '')   
>     else
>       i := i + 1;
>   until Message[i] = '';
> end;
> 
> begin
> end.

I don't do Delphi so I have to guess based on other programming
languages that I've played with.  Looking at your script, is:

  Message[i]

the same as:

  Message.strings[i]

I see the latter get used in the PHP-stripping script already defined
for the event.  Some programming languages default to the string value
if a type or attribute isn't specified for an object.

Also, how does this script limit its scan to just the headers (i.e., up
to the first blank line that delimits the headers)?  That seems to be
the point for the until-clause of the *outer* repeat loop.  Okay, but
then what is the point of the inner repeat loop (in the then-clause of
the if-statement)?  i isn't getting incremented there.  At that point in
that loop, i isn't changing.  

Since you delete that line via Message.delete(i), is the inner
until-clause looking at the *next* line to see if it is the blank
delimiter line for the header section?  That would only work in
Mesage[i+1] becomes Message[i] after deleting the original Message[i].
Does Delphia aka Pascal actually roll up the next item in an array into
a prior index position when a prior item in the array is deleted?  Does
line 4 become line 3 after you delete the original line 3?  If that were
true, and because you're still inside the inner repeat-loop, wouldn't it
just delete all lines in the message from that point?  Each subsquent
line rolls up in the array to get deleted again in the repeat loop until
the first line with a leading space character or null line (empty) was
found.  That seems like the inner repeat-loop would trigger on finding
X-Face in a header line and then proceed to delete every header line
thereafter and stopping only when it hit the blank delimiter line for
the header section.

If array items move up (get reassigned a reduced index count) on a
deletion of a prior item in the array then it seems you don't need the
repeat-loop in the then-clause.  If the X-Face string is found (starting
at position 1 on the line), it gets deleted, you don't modify the i
variable because the next item rolls into the i-indexed position in the
array, and you retest on the i position again for the next line that
rolled up.  You increment i if X-Face was NOT found to move to the next
line.  The outer until-clause checks if the current line indexed by the
yet unchanged i value is the blank delimiter line or not.

If array items don't automatically roll up to a prior index position
when prior items are deleted then what's the point of the inner
repeat-loop (in the then-clause of the if-statement)?
Technical Details
Message-ID: <jfpm3t$5sr$1@news.albasani.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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail
References: <1ass3sozlgobe$.1ov5otwd4to98$.dlg@40tude.net> <1e4muey1ojn1a.dlg@justacineast.motzarella.org> <jfko1d$3kq$1@news.albasani.net> <16ihfjp1m3ml1$.16m1mn0g0z6u3.dlg@40tude.net> <jfmu3a$saf$1@news.albasani.net> <5mkwbkqbbnvm.dlg@b.rose.tmpbox.news.arcor.de> <jfpj3f$uf2$1@news.albasani.net>

Show Full Headers
Complete Article Headers
Message-ID: <jfpm3t$5sr$1@news.albasani.net>
Subject: Re: Q.: Dialog and X-Face display ... ?
Date: Wed, 25 Jan 2012 13:45:03 -0600
From: VanguardLH <V@nguard.LH>
References: <1ass3sozlgobe$.1ov5otwd4to98$.dlg@40tude.net> <1e4muey1ojn1a.dlg@justacineast.motzarella.org> <jfko1d$3kq$1@news.albasani.net> <16ihfjp1m3ml1$.16m1mn0g0z6u3.dlg@40tude.net> <jfmu3a$saf$1@news.albasani.net> <5mkwbkqbbnvm.dlg@b.rose.tmpbox.news.arcor.de> <jfpj3f$uf2$1@news.albasani.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!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: Usenet denizen
Lines: 73
Sender: VanguardLH <no-email>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net
 1MPhA4rZ9U5dpZQZCTc4XEVrhZAKQ1lN2D3XNqhNR5Ldw62Qz/WcPIUzz8YCznONhR+EVYFNNVbCMASW8s74sA==
NNTP-Posting-Date: Wed, 25 Jan 2012 19:45:02 +0000 (UTC)
Injection-Info: news.albasani.net;
 logging-data="0hcKlmSAzXpTPzSa5jzfvzLluwinXXARkl1IXuQAqzDoyziOsSATONhHTpUuKbfklj7fQGkFuTvV9sWgcIIMEVlXaUwMnBXgabuHsauOMTHCD/UvHFm87bF3OgOYDDtw";
 mail-complaints-to="abuse@albasani.net"
Keywords: VanguardLH VLH811
User-Agent: 40tude_Dialog/2.0.15.41
Cancel-Lock: sha1:PAF5WqAlw65BYBIM66vfYL1QEsg=
X-Original-Bytes: 4565