From a1e63b4f6297285a824f2694903e517e73de69ae Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Fri, 6 Sep 2013 00:57:11 -0400 Subject: [PATCH] QWK client updates --- mdl/m_tcp_client_ftp.pas | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mdl/m_tcp_client_ftp.pas b/mdl/m_tcp_client_ftp.pas index c5d88df..d68da94 100644 --- a/mdl/m_tcp_client_ftp.pas +++ b/mdl/m_tcp_client_ftp.pas @@ -27,7 +27,7 @@ Type Function Authenticate (Login, Password: String) : Boolean; Function ChangeDirectory (Str: String) : Boolean; Function SendFile (Passive: Boolean; FileName: String) : Boolean; - Function GetFile (FilePath, FileName: String) : Boolean; + Function GetFile (Passive: Boolean; FileName: String) : Boolean; Procedure CloseConnection; End; @@ -193,9 +193,43 @@ Begin CloseDataSession; End; -Function TFTPClient.GetFile (FilePath, FileName: String) : Boolean; +Function TFTPClient.GetFile (Passive: Boolean; FileName: String) : Boolean; +Var + F : File; + Res : LongInt; + Buffer : Array[1..8*1024] of Char; Begin Result := False; + + If FileExist(FileName) Then Exit; + + SetPassive(Passive); + + Client.WriteLine('RETR ' + JustFile(FileName)); + + OpenDataSession; + + If GetResponse = 150 Then Begin + Assign (F, FileName); + + If ioReWrite(F, 1, fmRWDW) Then Begin + Repeat + Res := DataSocket.ReadBuf (Buffer, SizeOf(Buffer)); + + If Res > 0 Then + BlockWrite (F, Buffer, Res) + Else + Break; + Until False; + + Close (F); + End; + + CloseDataSession; + + Result := GetResponse = 226; + End Else + CloseDataSession; End; Function TFTPClient.ChangeDirectory (Str: String) : Boolean;