I have a NZB file, something like this:
<?xml version="1.0" encoding="utf-8" ?>
<nzb xmlns="http://www.newzbin.com/DTD/2003/nzb">
<head>
<meta type="title">Your File!</meta>
<meta type="tag">Example</meta>
</head>
<file poster="Joe Bloggs <bloggs@nowhere.example>"
date="1071674882"
subject="Here's your file! abc-mr2a.r01 (1/2)">
<groups>
<group>alt.binaries.newzbin</group>
<group>alt.binaries.mojo</group>
</groups>
<segments>
<segment bytes="102394" number="1">123456789abcdef@news.newzbin.com</segment>
<segment bytes="4501" number="2">987654321fedbca@news.newzbin.com</segment>
</segments>
</file>
</nzb>
Is there any way to download and assemble this file using Indy IdNNTP? I will be grateful for any sample code. Thanks in advance.
Actually, it was pretty easy:
Xml := TXmlVerySimple.Create;
Xml.Text:=recieved_nzb;
//Each <file> section
ChildNodes := Xml.Root.ChildNodes;
for q := 0 to ChildNodes.Count - 1 do
begin
IdNNTP1.SelectGroup(ChildNodes.Items[q].Find('groups').Find('group').Text);
SegmentNodes:=ChildNodes.Items[q].Find('segments').ChildNodes;
//Each <segment> (message)
for w := 0 to SegmentNodes.Count - 1 do
begin
idNNTP1.GetArticle(SegmentNodes.Items[w].Text,IdMessage1);
IdMessage1.SaveToFile('c:\!!!!\'+SegmentNodes.Items[w].Text, false);
Application.ProcessMessages;
end;
end;