If cliient ask about list of group - is called procedure TForm1.IdNNTPServer1ListGroups(AContext: TIdContext);i
Im ust modify AContext or send multiple times to client items of list which can be large?
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;
I must add dot at end or it is automatic?
It is automatic. I stated as much in my previous reply:
Quote:TIdNNTPServer sends a list terminator after the OnListGroups event handler exits