X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/17dff81c7141e142765b168ab225e5c61475669f..e296ac9f3d5fb224e0717b2ff410b913905f6b5f:/src/common/ftp.cpp diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 920e50e2cc..2b01b3a3e9 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -20,6 +20,8 @@ #pragma hdrstop #endif +#if wxUSE_SOCKETS + #ifndef __MWERKS__ #include #endif @@ -80,7 +82,7 @@ wxFTP::~wxFTP() //////////////////////////////////////////////////////////////// ////// wxFTP connect and login methods ///////////////////////// //////////////////////////////////////////////////////////////// -bool wxFTP::Connect(wxSockAddress& addr) +bool wxFTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait)) { if (!m_handler) { m_lastError = wxPROTO_NOHNDLR; @@ -249,9 +251,11 @@ bool wxFTP::RmFile(const wxString& path) class wxInputFTPStream : public wxSocketInputStream { public: wxFTP *m_ftp; + size_t m_ftpsize; wxInputFTPStream(wxFTP *ftp_clt, wxSocketBase *sock) : wxSocketInputStream(*sock), m_ftp(ftp_clt) {} + size_t StreamSize() const { return m_ftpsize; } virtual ~wxInputFTPStream(void) { if (LastError() != wxStream_NOERROR) @@ -328,6 +332,8 @@ bool wxFTP::Abort(void) wxInputStream *wxFTP::GetInputStream(const wxString& path) { wxString tmp_str; + int pos_size; + wxInputFTPStream *in_stream; if (!SendCommand("TYPE I", '2')) return NULL; @@ -343,7 +349,16 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) if (!SendCommand(tmp_str, '1')) return NULL; - return new wxInputFTPStream(this, sock); + in_stream = new wxInputFTPStream(this, sock); + + pos_size = m_lastResult.Index('('); + if (pos_size != wxNOT_FOUND) { + wxString str_size = m_lastResult(pos_size+1, m_lastResult.Index(')')-1); + + in_stream->m_ftpsize = atoi(WXSTRINGCAST str_size); + } + + return in_stream; } wxOutputStream *wxFTP::GetOutputStream(const wxString& path) @@ -388,5 +403,11 @@ wxList *wxFTP::GetList(const wxString& wildcard) return NULL; } + sock->SetEventHandler(*GetNextHandler(), m_id); + sock->Notify(m_notifyme); + sock->SetNotify(m_neededreq); + return file_list; } +#endif + // wxUSE_SOCKETS