Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[NNTP server]How to response with list of groups?
#2
The OnListGroups event is fired in response to a LIST command with no parameters. You need to write out the individual groups in the format used by the LIST ACTIVE command, eg:

Code:
procedure TForm1.IdNNTPServer1ListGroups(AContext: TIdContext);
begin
  with AContext.Connection.IOHandler do
  begin
    WriteLnRFC('group1 <high> <low> <status>');
    WriteLnRFC('group2 <high> <low> <status>');
    WriteLnRFC('group3 <high> <low> <status>');
    // and so on ...
  end;
end;

Or:

Code:
procedure TForm1.IdNNTPServer1ListGroups(AContext: TIdContext);
var
  List: TStringList;
begin
  List := TStringList.Create;
  try
    List.Add('group1 <high> <low> <status>');
    List.Add('group2 <high> <low> <status>');
    List.Add('group3 <high> <low> <status>');
    // and so on ...

    // using AWriteTerminator=False because TIdNNTPServer sends a list
    // terminator after the OnListGroups event handler exits...
    AContext.Connection.IOHandler.WriteRFCStrings(List, False);
  finally
    List.Free;
  end;
end;

Reply


Messages In This Thread
RE: [NNTP server]How to response with list of groups? - by rlebeau - 01-07-2020, 12:20 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)