Article View: borland.public.cppbuilder.internet.socket
Article #1647Re: Tranlation problem
From: Remy Lebeau (TeamB)
Date: Fri, 15 Dec 2006 06:33
Date: Fri, 15 Dec 2006 06:33
66 lines
3047 bytes
3047 bytes
"Roger Hemme" <rog@net.nl> wrote in message news:45823D21.30200@net.nl...
> The BCB-code:
In that case, your translation is pretty much right on. A directly
translation is as follows:
function FindParentMessage(Messages: TStrings; References: String):
TTreeNode;
var
pFirst, pStop, pStart, pEnd: PChar;
MsgIdToFind: String;
Idx: Integer;
begin
Result := nil;
if Length(References) = 0 then Exit;
pFirst := PChar(References);
pStop := (pFirst+2);
pEnd := AnsiLastChar(References);
// scan through the reference list from back to front as
// newer messages in a discussion are at the end of the list
while pEnd > pStop do
begin
// find the end of the MsgID
while (pEnd > pStop) and (pEnd^ <> '>') do Dec(pEnd);
if pEnd = pStop then Break;
// find the start of the MsgID
pStart := (pEnd-1);
while (pStart >= pFirst) and (pStart^ <> '<') do Dec(pStart);
if pStart < pFirst then Break;
// find the MsgID in the stored list. chances are, the parent
// message was downloaded just prior to the message currently
// being processed, so scan the stored messages from last to
first
SetString(MsgIdToFind, pStart, Longint(pEnd-pStart)+1);
for Idx := Messages.Count-1 downto 0 do
begin
if Messages.Strings[idx] = MsgIdToFind then
begin
// MsgID was found
Result := TTreeNode(Messages.Objects[idx]);
Exit;
end;
end;
// keep going
pEnd := (pStart-1);
end;
// MsgID not found
end;
// the rest I already gave you earlier...
With that said, you still haven't explained what exactly you are having a
problem with. Just saying that something is not working says nothing about
the actual problem.
Gambit
Technical Details
Message-ID:
<458242a2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4581cf08@newsgroups.borland.com> <4581d5f4$2@newsgroups.borland.com> <4581DE1B.7050909@net.nl> <45820e5d@newsgroups.borland.com> <45823D21.30200@net.nl>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,882d665e9542934a X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4581cf08@newsgroups.borland.com> <4581d5f4$2@newsgroups.borland.com> <4581DE1B.7050909@net.nl> <45820e5d@newsgroups.borland.com> <45823D21.30200@net.nl> Subject: Re: Tranlation problem Date: Thu, 14 Dec 2006 22:33:36 -0800 Lines: 68 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <458242a2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1166164642 75.83.34.171 (14 Dec 2006 22:37:22 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail