From 9bf4197e0a41e022f3b775104303b74f3249de23 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Wed, 2 Sep 2015 23:09:27 +0300 Subject: [PATCH] Added sfFtp_sendCommand --- include/SFML/Network/Ftp.h | 20 ++++++++++++++++++++ src/SFML/Network/Ftp.cpp | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/include/SFML/Network/Ftp.h b/include/SFML/Network/Ftp.h index 34009a8..82789e3 100644 --- a/include/SFML/Network/Ftp.h +++ b/include/SFML/Network/Ftp.h @@ -506,5 +506,25 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantF //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode); +//////////////////////////////////////////////////////////// +/// \brief Send a command to the FTP server +/// +/// While the most often used commands are provided as +/// specific functions, this function can be used to send +/// any FTP command to the server. If the command requires +/// one or more parameters, they can be specified in +/// \a parameter. Otherwise you should pass NULL. +/// If the server returns information, you can extract it +/// from the response using sfResponse_getMessage(). +/// +/// \param ftp Ftp object +/// \param command Command to send +/// \param parameter Command parameter +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_NETWORK_API sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter); + #endif // SFML_FTP_H diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index 26dac6f..474b3f5 100644 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp @@ -307,3 +307,12 @@ sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destP destPath ? destPath : "", static_cast(mode))); } + + +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter) +{ + CSFML_CHECK_RETURN(ftp, NULL); + + return new sfFtpResponse(ftp->This.sendCommand(command ? command : "", parameter ? parameter : "")); +}