Re: Problem With Understanding Article Numbering And MessageID

Giganews Newsgroups
Subject: Re: Problem With Understanding Article Numbering And MessageID
Posted by:  news.atozedsoftware.com (frank.bish…@versatrans.com)
Date: Wed, 30 Jul 2008

Gambit ,

Thanks for your reply.

I am working on a nntp client. See code in the previous post.

In my nntp client I save the raw groups and the raw headers to a file.

By writing out the String List returned from XOVER

//----------------------
// connect and select group first

var
  f : textfile;
  RawListofHeaders : TStringList;

begin

  RawListofHeaders := TStringList.Create;

  NNTP1.XOVER(allmessages, RawListofHeaders);

  assignfile(f,'rawheaderinfo.txt');
  rewrite(f);

  for i := 0 to RawListofheaders.count - 1 do
  begin
    writeln(f,RawListofHeaders[i]);
  end;

  closefile(f);

  freeandnil(RawListofHeaders);
end;

// disconnect when done
//----------------------

so if I look through the raw header data in various groups

some examples to try

atozedsoftware.indy.client.tcp
atozedsoftware.indy.coders
atozedsoftware.indy.documentation
atozedsoftware.indy.protocol.ftp

using code to search for duplicate article numbers

I can see the results (this can also be done by manually scanning through
the raw header information on file)

code to help look for duplicates

//----------------------
//----------------------

procedure TForm1.Dump_List(var LS : TStringList);
var s : string;
    i,t,p : integer;
begin
  t := LS.Count - 1;
  for i := 0 to t do
  begin
    s := LS[i];
    p := LS.IndexOf(s);
    if p = i then
    begin
      memo1.Lines.add(s);
    end
    else
    begin
      memo1.Lines.add(s + '- Duplicate');
    end;
  end;
end;

//----------------------

procedure TForm1.Button1Click(Sender: TObject);
var f : textfile;
    s : string;
    i,t : integer;
    templist : TStringList;
begin

  memo1.Lines.Clear;
  templist := TStringList.Create;

  if edit1.Text <> '' then
  begin

    if fileexists(edit1.Text) then
    begin

      // run the test
      assignfile(f,edit1.Text);
      reset(f);

      while not(eof(f)) do
      begin
        readln(f,s);
        t := length(s);
        i := pos(#9,s);
        if (i <> 0) then delete(s,i,t);
        Templist.Add(s);
      end;

      closefile(f);

      // Now Dump The List
      Dump_List(templist);

      freeandnil(templist);

    end
    else
    begin
      memo1.Lines.add('File Doesnt Exist');
    end;

  end
  else
  begin
    memo1.Lines.add('Select A File First');
  end;

end;

//----------------------

procedure TForm1.Button2Click(Sender: TObject);
begin
  // run the open dialog
  opendialog1.Filter := 'Text Files|*.txt';

  if opendialog1.execute = true then
  begin
    edit1.Text := opendialog1.FileName;
    Button1Click(Sender);
  end;

end;

//----------------------
//----------------------

Esentially this problem is only really an issue because

// Test Case 1 Using MessageID
// doesnt appear to work for news.atozedsoftware.com

  IdNNTP1.GetArticle(NewsMessageID, IdMessage1);

I have to use this overloaded version of GetArticle to retrieve messages
from news.atozedsoftware.com

// Test Case 2 Using Article No
// works for news.atozedsoftware.com

  IdNNTP1.GetArticle(NewsArticle, IdMessage2);

I havent tried any alternative mechanisms like getbody or get next message
yet but I
basically pop up the raw headers in a string gridand then allow the user to
select one
header and get that message

Thanks In Advance,

PS I really appreciate being able to talk to someone about these technical
details

Frank

Replies

None

In response to

Problem With Understanding Article Numbering And MessageID posted by Francis Bishop on Mon, 28 Jul 2008