From db0a22a226249c09a4d79c7d8e41ac6b17c24892 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 6 Dec 2018 20:46:44 +0100 Subject: [PATCH] JSON API for /rsFiles/FileClearCompleted --- libretroshare/src/ft/ftcontroller.cc | 12 ++++++------ libretroshare/src/retroshare/rsfiles.h | 15 +++++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 06e8a0e9c..18dec7686 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1396,25 +1396,25 @@ bool ftController::FileControl(const RsFileHash& hash, uint32_t flags) return true; } -bool ftController::FileClearCompleted() +bool ftController::FileClearCompleted() { #ifdef CONTROL_DEBUG std::cerr << "ftController::FileClearCompleted()" <::iterator it(mCompleted.begin());it!=mCompleted.end();++it) - delete it->second ; + for(auto it(mCompleted.begin()); it != mCompleted.end(); ++it) + delete it->second; mCompleted.clear(); IndicateConfigChanged(); - } /******* UNLOCKED ********/ + } RsServer::notify()->notifyDownloadCompleteCount(0); - return false; + return true; } /* get Details of File Transfers */ diff --git a/libretroshare/src/retroshare/rsfiles.h b/libretroshare/src/retroshare/rsfiles.h index 811c172d5..2a66f6405 100644 --- a/libretroshare/src/retroshare/rsfiles.h +++ b/libretroshare/src/retroshare/rsfiles.h @@ -318,7 +318,7 @@ public: /** * @brief Get free disk space limit * @jsonapi{development} - * @return current current minimum free space on disk in MB + * @return current minimum free space on disk in MB */ virtual uint32_t freeDiskSpaceLimit() const = 0; @@ -329,8 +329,15 @@ public: */ virtual void setFreeDiskSpaceLimit(uint32_t minimumFreeMB) = 0; - virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0; - virtual bool FileClearCompleted() = 0; + virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0; + + /** + * @brief Clear completed downloaded files list + * @jsonapi{development} + * @return false on error, true otherwise + */ + virtual bool FileClearCompleted() = 0; + virtual void setDefaultEncryptionPolicy(uint32_t policy)=0; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE virtual uint32_t defaultEncryptionPolicy()=0; virtual void setMaxUploadSlotsPerFriend(uint32_t n)=0; @@ -390,7 +397,7 @@ public: * @return true if file found, false otherwise */ virtual bool FileDetails( - const RsFileHash &hash, FileSearchFlags hintflags, FileInfo& info ) = 0; + const RsFileHash& hash, FileSearchFlags hintflags, FileInfo& info ) = 0; virtual bool isEncryptedSource(const RsPeerId& virtual_peer_id) =0;