🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #139627

Re: Get the parent message in Dialog

#139627
From: MLC
Date: Sat, 20 Dec 2003 18:01
152 lines
5155 bytes
Il 20/dic/2003 Enrico C ha scritto:

> Mind you, you posted your script in a reply to Jeff Relf, but many
> people here have plonked him and even his threads, so they might have
> missed your post. They can retrieve it, if they want, anyway  :)

Since I've also changed a little the script (as you pointed out there were
conflicts with another script), I post here again the new version:
(note anyway that IMHO Jeff Relf is not a troll, he is only a little
bizarre!)

Program GoToParent;
uses
   Forms,
   StdCtrls;
var
   myForm: TForm;
   myMemo: TMemo;
   Refs: string;
   ParentID: string;
FUNCTION EmptyClipboard:boolean; external 'EmptyClipboard@user32.dll 
stdcall';
FUNCTION OpenClipboard(hWndNewOwner: INTEGER):boolean; external 
'OpenClipboard@user32.dll stdcall';
FUNCTION CloseClipboard:boolean; external 'CloseClipboard@user32.dll 
stdcall';

PROCEDURE ClearCLipboard;
BEGIN
 OpenClipboard(0);
 EmptyClipboard;
 CloseClipboard;
END;

PROCEDURE GetMessBody (var LocMymemo: tMemo);
BEGIN
 LocMyMemo.Clear;
 ClearCLipboard;
 ADo('ArticlePane');
 ADo('SelectAll');
 Ado('Copy');
 LocMyMemo.PasteFromClipboard;
END;

FUNCTION RefsExtract( HeaderTag: String; var LocMymemo: tmemo): string;
var
 index : integer;
 allrefs: string;
BEGIN
 index := 0;
 allrefs := '';
 WHILE (index < LocMymemo.Lines.count-1) AND (allrefs = '') DO
 BEGIN
   IF POS(HeaderTag,LocMymemo.lines.Strings[index]) = 1 THEN
   BEGIN
    allrefs := LocMymemo.lines.Strings[index];
    index := index+1;
    WHILE (index < LocMymemo.Lines.count-1)
    AND (POS('<',LocMymemo.lines.Strings[index])=1) DO
    BEGIN
     allrefs := allrefs + LocMymemo.lines.Strings[index];
     index := index+1;
    END
  END
  index := index+1;
 END;
  result:=allrefs;
END;

FUNCTION GetHeaderInfo(HeaderTag : string; var LocMymemo : tMemo): string;
BEGIN
 Result := RefsExtract(HeaderTag, LocMymemo);
 delete(Result, 1, length(HeaderTag));
END;

FUNCTION GetRefs(var LocMymemo : tMemo): string;
BEGIN
 result := GetHeaderInfo('References: ', LocMymemo);
END;
   
FUNCTION GetParent(var LocRefs: string): string;
var
 tag: string;
 index: integer;
 posiz, lung : integer;
BEGIN
 tag := '<';
 index := length(LocRefs)-1;
 result := '';
 posiz := 0;
 while (index > 0) and (posiz = 0) do
 begin
  if Pos(tag, LocRefs[index])=0 then
    index:=index-1
  else
    posiz := index;
    lung:=length(LocRefs)-posiz+1;
    result := copy(LocRefs, posiz, lung);
  end
END;

FUNCTION AreHeadersHid(var LocMymemo : tMemo): boolean;
var
 index: integer;
 temp: boolean;
BEGIN
 temp := true;
 IF LocMyMemo.Lines.count > 10 THEN
 BEGIN
  index := 0;
  WHILE (Index < LocMyMemo.Lines.count -1) and temp DO
  BEGIN
   index := index+1;
   temp := Pos('Newsgroups: ', LocMyMemo.Lines.strings[index]) = 0;
  END;
 END;
result := temp;
END;       

Begin
   myForm := tForm.Create(nil);
   myForm.width:=800;
   myForm.Height:=600;
   myMemo := tMemo.Create(myForm);
   myMemo.Parent := myForm;
   myMemo.Width := myForm.width;
   myMemo.Height := myForm.Height;
   try
   GetMessBody(myMemo);
   if AreHeadersHid(myMemo) then
      ADo('ShowHeaders');
   GetMessBody(myMemo);
   Refs := GetRefs(myMemo);
   myMemo.Clear;
   myMemo.Lines.Add(Refs);
   ParentID := GetParent(Refs);
   ClearClipboard;
   myMemo.Clear;
   myMemo.Lines.Add(ParentID);
   myMemo.SelectAll;
   myMemo.CopyToClipboard;
   if AreHeadersHid(myMemo) then
     ADo('ShowHeaders');
   finally
   myform.free;
   Ado('FindMessageID');
   end;
End.

-- 
Maria Luisa C - 20/12/2003 18.52.40, here.
http://fido.altervista.org/
Technical Details
Message-ID: <xyte4qycayk8$.dlg@ID-187316.user.uni-berlin.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!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!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!fu-berlin.de!uni-berlin.de!ppp-87-200.26-151.libero.IT!not-for-mail
References: <1hev6ezm1d4ht$.z90e0hp3rrrn$.dlg@40tude.net> <1rnt6r0bjuhq7$.dlg@ID-187316.user.uni-berlin.de> <1nferh60fdeta.dlg@news.lillathedog.net>

Show Full Headers
Complete Article Headers
Message-ID: <xyte4qycayk8$.dlg@ID-187316.user.uni-berlin.de>
Subject: Re: Get the parent message in Dialog
Date: Sat, 20 Dec 2003 19:01:24 +0100
From: MLC <maluc52@yahoo.it>
References: <1hev6ezm1d4ht$.z90e0hp3rrrn$.dlg@40tude.net> <1rnt6r0bjuhq7$.dlg@ID-187316.user.uni-berlin.de> <1nferh60fdeta.dlg@news.lillathedog.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!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!fu-berlin.de!uni-berlin.de!ppp-87-200.26-151.libero.IT!not-for-mail
Newsgroups: news.software.readers
Organization: none
Lines: 152
Reply-To: mlcald@msn.com
NNTP-Posting-Host: ppp-87-200.26-151.libero.it (151.26.200.87)
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 1071943288 9339926 151.26.200.87 ([187316])
User-Agent: 40tude_Dialog/2.0.8.1 (34d43326.227.300)
X-Face: (O6iue.kQNT|`uU@vD|.WKC^TF~T<TIA,\;
 B'27kz>*1Mk|Z6U!2EKSFc')'xVk]t'/3<,#
 #L+5&I{L<!Q%p[k|+%mSCT"e2\4JnDJhbQ,`EA4fu$q0q>{7W?\gQeqD@*lzcR0~:9Zzn!1yCRb