Atozed Forums

Full Version: NNTP group info
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to get not only group names but group descriptions?
You have to send the server a 'LIST NEWSGROUPS' command. However, TIdNNTP does not implement that particular command at this time (it currently only implements 'LIST', 'LIST OVERVIEW.FMT', and 'LIST EXTENSIONS'), so you will have to send the command manually and then parse the response yourself, eg:

Code:
var
  LResponse: TStringList;
  I, J: Integer;
  LName, LDesc: string;
begin
  LResponse := TStringList.Create;
  try
    IdNNTP1.SendCmd('LIST NEWSGROUPS', 215);
    IdNNTP1.IOHandler.Capture(LResponse, IndyTextEncoding_8Bit);
    for I := 0 to LResponse.Count-1 do
    begin
      J := FindFirstOf(' '#9, LResponse[I]);
      LName := Copy(LResponse[I], 1, J-1);
      LDesc := Copy(LResponse[I], J+1, MaxInt);
      ...
    end;
  finally
    LResponse.Free;
  end;
end;