mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 21:04:32 -05:00
Added Function to move an 'extraFile' to another location.
This will be used to retrieve channel files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@844 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d56d3e57f9
commit
f5fa2f9a68
@ -197,6 +197,30 @@ bool ftExtraList::removeExtraFile(std::string hash, uint32_t flags)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ftExtraList::moveExtraFile(std::string fname, std::string hash, uint64_t size,
|
||||||
|
std::string destpath)
|
||||||
|
{
|
||||||
|
RsStackMutex stack(extMutex);
|
||||||
|
|
||||||
|
std::map<std::string, FileDetails>::iterator it;
|
||||||
|
it = mFiles.find(hash);
|
||||||
|
if (it == mFiles.end())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string path = destpath + '/' + fname;
|
||||||
|
if (0 == rename(it->second.info.path.c_str(), path.c_str()))
|
||||||
|
{
|
||||||
|
/* rename */
|
||||||
|
it->second.info.path = path;
|
||||||
|
it->second.info.fname = fname;
|
||||||
|
IndicateConfigChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ftExtraList::cleanupOldFiles()
|
bool ftExtraList::cleanupOldFiles()
|
||||||
|
@ -121,6 +121,9 @@ bool addExtraFile(std::string path, std::string hash,
|
|||||||
uint64_t size, uint32_t period, uint32_t flags);
|
uint64_t size, uint32_t period, uint32_t flags);
|
||||||
|
|
||||||
bool removeExtraFile(std::string hash, uint32_t flags);
|
bool removeExtraFile(std::string hash, uint32_t flags);
|
||||||
|
bool moveExtraFile(std::string fname, std::string hash, uint64_t size,
|
||||||
|
std::string destpath);
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Hash file, and add to the files,
|
* Hash file, and add to the files,
|
||||||
|
@ -301,6 +301,13 @@ bool ftServer::ExtraFileStatus(std::string localpath, FileInfo &info)
|
|||||||
return mFtExtra->hashExtraFileDone(localpath, info);
|
return mFtExtra->hashExtraFileDone(localpath, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ftServer::ExtraFileMove(std::string fname, std::string hash, uint64_t size,
|
||||||
|
std::string destpath)
|
||||||
|
{
|
||||||
|
return mFtExtra->moveExtraFile(fname, hash, size, destpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/******************** Directory Listing ************************/
|
/******************** Directory Listing ************************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
@ -130,6 +130,8 @@ virtual bool ExtraFileRemove(std::string hash, uint32_t flags);
|
|||||||
virtual bool ExtraFileHash(std::string localpath,
|
virtual bool ExtraFileHash(std::string localpath,
|
||||||
uint32_t period, uint32_t flags);
|
uint32_t period, uint32_t flags);
|
||||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
||||||
|
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
|
||||||
|
std::string destpath);
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
@ -119,6 +119,9 @@ virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
|
|||||||
virtual bool ExtraFileHash(std::string localpath,
|
virtual bool ExtraFileHash(std::string localpath,
|
||||||
uint32_t period, uint32_t flags) = 0;
|
uint32_t period, uint32_t flags) = 0;
|
||||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
||||||
|
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
|
||||||
|
std::string destpath) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
Loading…
Reference in New Issue
Block a user