Suggestion for TOP:
function TPOP3Send.Top(Value:integer; Maxlines: Integer=0): Boolean;
begin
if Maxlines=0 then
Result := CustomCommand('TOP ' + IntToStr(Value),true)
else
Result := CustomCommand('TOP ' + IntToStr(Value) + ' ' +
IntToStr(Maxlines), True);
end;
No difference, howveer maybe some servers will fail on, i.e. TOP 1 0.
> Last change is in pop3send, where i add new CustomCommand method for
> calling any POP3 custom command. This new method is used internally
> by pop3send too.
Clear is much clearer now.
Regarding needs for telnet ability and global SendCommand, this is not quit
satisfied, since full server responses ('+OK', '-ERR' and '.') are not
included (reason I duplicated code without parsing).
Perhaps to add parsing parameter? Functionz changes are minimum, with full
backward compatibility:
function TPOP3Send.CustomCommand(const Command: string; MultiLine: Boolean;
Parse:Boolean=true): boolean;
begin
FSock.SendString(Command + CRLF);
Result := ReadResult(MultiLine, Parse) <> 0;
end;
And:
function TPOP3Send.ReadResult(Full: Boolean; Parse:Boolean=true): Integer;
var
s: string;
begin
Result := 0;
FFullResult.Clear;
s := FSock.RecvString(FTimeout);
if Pos('+OK', s) = 1 then
Result := 1;
FResultString := s;
//SZ
If not Parse then
FFullResult.Add(s);
if Full and (Result = 1) then
repeat
s := FSock.RecvString(FTimeout);
if s = '.' then
Break;
//SZ
If Parse then
begin
if s <> '' then
if s[1] = '.' then
Delete(s, 1, 1);
end;
FFullResult.Add(s);
until FSock.LastError <> 0;
//SZ
if not Full and (Result = 1) and not Parse then
FFullResult.Add(SeparateRight(FResultString, ' '));
if FSock.LastError <> 0 then
Result := 0;
FResultCode := Result;
end;
One more suggestion is to change name of CustomCommand to SendCommand or
SendCMD, at least for public method.
Sasa
--
www.szutils.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public