🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #251754

Re: Excessive blank lines in Dialog

#251754
From: PeterC
Date: Wed, 03 Oct 2012 15:37
122 lines
5776 bytes
On Sun, 30 Sep 2012 21:17:18 +0200, Bernd Rose wrote:

> On Sun, 30 Sep 2012 10:04:39 +0100, PeterC wrote:
> 
>> On Sat, 29 Sep 2012 11:21:25 -0500, VanguardLH wrote:
> [Remove consecutive blank quoted lines]
>> Looks as if the problem has been addressed, then. Scripts and so-on are well
>> beyond my expertise so I'll stick with Q for now, but thanks for the info.
>  
> Maybe you can take the following code as an example and starting point 
> for you own adjustments. It is just a quick hack, but hopefully will
> not destroy valid parts of messages. - Although any bugs are mine, the 
> responsibility of using the script is left to you...  ;-)
> 
> The script tries to detect and retain valid paragraphs and cleans up
> quoting chars with spaces in between. - Part of the code is adopted
> from Dietmar Vollmeiers QuoteCorrection scripts:
> 
> http://4d.vollmeier.at/scripte/ereignisscripte/onbeforesavingmessage/quotecorrection.html
> 
> If you don't already use an OnBeforeSavingMessage event script, just
> replace the current code with the one below. Else, just copy the
> TrimQLines procedure inside the current OnBeforeSavingMessage program 
> body and insert the 
> 
>    TrimQLines(Message);
> 
> line into the OnBeforeSavingMessage procedure body. 
> 
> Afterwards, you need to save and compile the event script.
> 
> HTH.
> Bernd

Bernd.

Thank you for this. Eventually I dropped a script in to the Custom folder
and found the Compile part in Dialog. Not sure if it's working as, due to
Sod's Law, I had to wait several days to get enough posts coming in to see
what was happening.
So far it looks as if > might have gone but >> or more are still there.

I don't actually understand any of this, so is the following OK?

I have OnBeforeSavingMessage.cds:

(*******************************************************************************
*                            QuoteCorrection 2.0.2
*
*                            OnBeforeSavingMessage
*
*                            OnBeforeSendingMessage
*
*******************************************************************************)

program OnBeforeSavingMessage;

Procedure TrimQLines(var Message : TStringlist);
Var
  iPtr, iCnt, iMax : Integer;
  sLine, sTmp, sBuffer : String;
  bBuff : Boolean;
Begin
  With Message Do
  Begin
    If IndexOf('-- ') > -1 Then iMax := IndexOf('-- ') - 1
    If IndexOf('--') > -1 Then iMax := IndexOf('--') - 1
    Else iMax := Count - 1;
    iPtr := IndexOf('') + 1;
    sBuffer := '';
    bBuff := True;
    For iCnt := IndexOf('') + 1 To iMax Do
    Begin
      sLine := Strings[iCnt];
      sTmp := StringReplace(sLine, '>', '', [rfReplaceAll]);
      sTmp := StringReplace(sTmp, ':', '', [rfReplaceAll]);
      sTmp := Trim(StringReplace(sTmp, '|', '', [rfReplaceAll]));
      If (Length(sTmp) > 0) Or (Trim(sLine) = '') Then
      Begin
        If (Length(sBuffer) > 0) And bBuff Then 
        Begin
          Strings[iPtr] := sBuffer;
          iPtr := iPtr + 1;
        End;
        sTmp := TrimRight(sLine);
        If (Length(sTmp) > 2) Then
          If AnsiPos(sTmp[1], '>:|') > 0 Then
          Begin
            sTmp := StringReplace(sTmp, '> >', '>>', [rfReplaceAll]);
            sTmp := StringReplace(sTmp, ': :', '::', [rfReplaceAll]);
            sTmp := StringReplace(sTmp, '| |', '||', [rfReplaceAll]);
          End;
        Strings[iPtr] := sTmp;
        iPtr := iPtr + 1;
        sBuffer := '';
        If (Length(sTmp) < 55) Then bBuff := True
        Else bBuff := (AnsiPos(sTmp[Length(sTmp)], '.?!-') > 0);
      End
      Else
      Begin
        sTmp := StringReplace(sLine, ' ', '', [rfReplaceAll]);
        If Length(sTmp) > Length(sBuffer) Then sBuffer := sTmp;
      End;
    End;
    For iCnt := iPtr To iMax Do Delete(iPtr);
  End;
End;

procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean);
begin
   If Message.Count = 0 Then Exit;  
   TrimQLines(Message);
end;

begin                                                     
end.

-- 
Peter.
The gods will stay away 
whilst religions hold sway
Technical Details
Message-ID: <hach34o0b9zb$.1sapq5uno78s0.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!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!l8no22817300qao.0!news-out.google.com!q10ni64953201wif.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
References: <1givb5i5wmhfr.43akjwrkjzai.dlg@40tude.net> <k47764$4sm$1@news.albasani.net> <1qugc0d50ipjn$.1ul9jdnffldeu$.dlg@40tude.net> <16mlhe65uaaig$.dlg@b.rose.tmpbox.news.arcor.de>

Show Full Headers
Complete Article Headers
Message-ID: <hach34o0b9zb$.1sapq5uno78s0.dlg@40tude.net>
Subject: Re: Excessive blank lines in Dialog
Date: Wed, 3 Oct 2012 16:37:52 +0100
From: PeterC <giraffenos.pam@homecall.co.uk>
References: <1givb5i5wmhfr.43akjwrkjzai.dlg@40tude.net> <k47764$4sm$1@news.albasani.net> <1qugc0d50ipjn$.1ul9jdnffldeu$.dlg@40tude.net> <16mlhe65uaaig$.dlg@b.rose.tmpbox.news.arcor.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!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!l8no22817300qao.0!news-out.google.com!q10ni64953201wif.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
Received: by 10.180.84.74 with SMTP id w10mr3826039wiy.4.1349278673496;
Newsgroups: news.software.readers
Organization: A noiseless patient Spider
Lines: 122
Reply-To: giraffe@homecall.co.uk
Mime-Version: 1.0
Injection-Info: mx04.eternal-september.org;
 posting-host="0b5ac63ef5398d738662a6ced8787533";
 logging-data="9146"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX18KCJN0ev7NkvrGDOQVoJ+5"
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:f6E05r+5n8KlkOB3l+o8t7WC2AY=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Original-Bytes: 5506