mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 06:32:55 -04:00
Expose some RsFiles method trought JSON API
This commit is contained in:
parent
102558afdf
commit
1c63cec735
1 changed files with 64 additions and 11 deletions
|
@ -32,8 +32,14 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "rstypes.h"
|
#include "rstypes.h"
|
||||||
|
#include "serialiser/rsserializable.h"
|
||||||
|
|
||||||
class RsFiles;
|
class RsFiles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pointer to global instance of RsFiles service implementation
|
||||||
|
* @jsonapi{development}
|
||||||
|
*/
|
||||||
extern RsFiles* rsFiles;
|
extern RsFiles* rsFiles;
|
||||||
|
|
||||||
namespace RsRegularExpression { class Expression; }
|
namespace RsRegularExpression { class Expression; }
|
||||||
|
@ -108,7 +114,7 @@ const TransferRequestFlags RS_FILE_REQ_NO_SEARCH ( 0x02000000 ); // di
|
||||||
|
|
||||||
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
const uint32_t RS_FILE_EXTRA_DELETE = 0x0010;
|
||||||
|
|
||||||
struct SharedDirInfo
|
struct SharedDirInfo : RsSerializable
|
||||||
{
|
{
|
||||||
static bool sameLists(const std::list<RsNodeGroupId>& l1,const std::list<RsNodeGroupId>& l2)
|
static bool sameLists(const std::list<RsNodeGroupId>& l1,const std::list<RsNodeGroupId>& l2)
|
||||||
{
|
{
|
||||||
|
@ -124,8 +130,20 @@ struct SharedDirInfo
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string virtualname;
|
std::string virtualname;
|
||||||
FileStorageFlags shareflags ; // combnation of DIR_FLAGS_ANONYMOUS_DOWNLOAD | DIR_FLAGS_BROWSABLE | ...
|
|
||||||
|
/// combnation of DIR_FLAGS_ANONYMOUS_DOWNLOAD | DIR_FLAGS_BROWSABLE | ...
|
||||||
|
FileStorageFlags shareflags;
|
||||||
std::list<RsNodeGroupId> parent_groups;
|
std::list<RsNodeGroupId> parent_groups;
|
||||||
|
|
||||||
|
/// @see RsSerializable::serial_process
|
||||||
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,
|
||||||
|
RsGenericSerializer::SerializeContext& ctx)
|
||||||
|
{
|
||||||
|
RS_SERIAL_PROCESS(filename);
|
||||||
|
RS_SERIAL_PROCESS(virtualname);
|
||||||
|
RS_SERIAL_PROCESS(shareflags);
|
||||||
|
RS_SERIAL_PROCESS(parent_groups);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SharedDirStats
|
struct SharedDirStats
|
||||||
|
@ -282,10 +300,45 @@ public:
|
||||||
virtual std::string getDownloadDirectory() = 0;
|
virtual std::string getDownloadDirectory() = 0;
|
||||||
virtual std::string getPartialsDirectory() = 0;
|
virtual std::string getPartialsDirectory() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get list of current shared directories
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[out] dirs storage for the list of share directories
|
||||||
|
* @return false if something failed, true otherwhise
|
||||||
|
*/
|
||||||
virtual bool getSharedDirectories(std::list<SharedDirInfo>& dirs) = 0;
|
virtual bool getSharedDirectories(std::list<SharedDirInfo>& dirs) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set shared directories
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] dirs list of shared directories with share options
|
||||||
|
* @return false if something failed, true otherwhise
|
||||||
|
*/
|
||||||
virtual bool setSharedDirectories(const std::list<SharedDirInfo>& dirs) = 0;
|
virtual bool setSharedDirectories(const std::list<SharedDirInfo>& dirs) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add shared directoryaddSharedDirectory
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] dir directory to share with sharing options
|
||||||
|
* @return false if something failed, true otherwhise
|
||||||
|
*/
|
||||||
virtual bool addSharedDirectory(const SharedDirInfo& dir) = 0;
|
virtual bool addSharedDirectory(const SharedDirInfo& dir) = 0;
|
||||||
virtual bool updateShareFlags(const SharedDirInfo& dir) = 0; // updates the flags. The directory should already exist !
|
|
||||||
|
/**
|
||||||
|
* @brief Updates shared directory sharing flags.
|
||||||
|
* The directory should be already shared!
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param dir[in] Shared directory with updated sharing options
|
||||||
|
* @return false if something failed, true otherwhise
|
||||||
|
*/
|
||||||
|
virtual bool updateShareFlags(const SharedDirInfo& dir) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove directory from shared list
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param dir[in] Path of the directory to remove from shared list
|
||||||
|
* @return false if something failed, true otherwhise
|
||||||
|
*/
|
||||||
virtual bool removeSharedDirectory(std::string dir) = 0;
|
virtual bool removeSharedDirectory(std::string dir) = 0;
|
||||||
|
|
||||||
virtual bool getIgnoreLists(std::list<std::string>& ignored_prefixes, std::list<std::string>& ignored_suffixes,uint32_t& flags) =0;
|
virtual bool getIgnoreLists(std::list<std::string>& ignored_prefixes, std::list<std::string>& ignored_suffixes,uint32_t& flags) =0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue