🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #251739

Re: Excessive blank lines in Dialog

#251739
From: Bernd Rose
Date: Sun, 30 Sep 2012 19:17
95 lines
4706 bytes
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

-----------------------------<Snip>------------------------------------
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.
Technical Details
Message-ID: <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.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.musoftware.de!wum.musoftware.de!news2.arglkargh.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
References: <1givb5i5wmhfr.43akjwrkjzai.dlg@40tude.net> <k47764$4sm$1@news.albasani.net> <1qugc0d50ipjn$.1ul9jdnffldeu$.dlg@40tude.net>

Show Full Headers
Complete Article Headers
Message-ID: <16mlhe65uaaig$.dlg@b.rose.tmpbox.news.arcor.de>
Subject: Re: Excessive blank lines in Dialog
Date: Sun, 30 Sep 2012 21:17:18 +0200
From: Bernd Rose <b.rose.tmpbox@expires-2012-09-30.arcornews.de>
References: <1givb5i5wmhfr.43akjwrkjzai.dlg@40tude.net> <k47764$4sm$1@news.albasani.net> <1qugc0d50ipjn$.1ul9jdnffldeu$.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.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.musoftware.de!wum.musoftware.de!news2.arglkargh.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.15.41 (8eaebd14.63.398)
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Lines: 95
Organization: Arcor
NNTP-Posting-Date: 30 Sep 2012 21:17:22 CEST
NNTP-Posting-Host: 78f06942.newsspool1.arcor-online.net
X-Trace: DXC=D1[3be01MTPaAeROF2PWMQic==]BZ:af^4Fo<]lROoRQnkgeX?EC@@P@k9I1YG3X@TBYf[Tl<>RjZ0KKF0Xe`9N^>P7\kT;
 ?EZ^
X-Complaints-To: usenet-abuse@arcor.de
X-Original-Bytes: 4413