ChannelFeed:

- Sort the ChanMsgItems of the channel by date

ChanMsgItem:
- Fixed adding all files (SubFileItem) again by pressing the unsubscribe button (only in Friend Storm)
- Enable unsubscribe button only when channel is subscribed (only in Friend Storm)
- Fixed adding files with umlauts (utf8) on Windows
- Enabled Download and Play button in ChanMsgItem, when they are enabled in the SubFileItems

ftServer:
- Added the method alreadyHaveFile for use in the GUI - recompile of GUI needed

SubFileItem:
- Added state strings like LOCAL, REMOTE, ERROR, ... for translating


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3614 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-05 20:39:14 +00:00
parent 3c29434007
commit d31cef0f11
14 changed files with 290 additions and 120 deletions

View file

@ -994,12 +994,10 @@ bool ftController::handleAPendingRequest()
return true ;
}
bool ftController::alreadyHaveFile(const std::string& hash)
bool ftController::alreadyHaveFile(const std::string& hash, FileInfo &info)
{
FileInfo info ;
// check for downloads
if(FileDetails(hash, info) && (info.downloadStatus == FT_STATE_COMPLETE))
if (FileDetails(hash, info) && (info.downloadStatus == FT_STATE_COMPLETE))
return true ;
// check for file lists
@ -1017,7 +1015,8 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
/* check if we have the file */
if(alreadyHaveFile(hash))
FileInfo info;
if(alreadyHaveFile(hash, info))
return false ;
if(size == 0) // we treat this special case because
@ -1077,7 +1076,6 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
}
}
FileInfo info;
std::list<std::string>::const_iterator it;
std::list<TransferInfo>::const_iterator pit;

View file

@ -142,7 +142,7 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
const std::list<std::string> &sourceIds);
/// Do we already have this file, either in download or in file lists ?
bool alreadyHaveFile(const std::string& hash) ;
bool alreadyHaveFile(const std::string& hash, FileInfo &info);
bool setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStrategy s);
void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s);

View file

@ -281,6 +281,11 @@ bool ftServer::checkHash(const std::string& hash,std::string& error_string)
return true ;
}
bool ftServer::alreadyHaveFile(const std::string& hash, FileInfo &info)
{
return mFtController->alreadyHaveFile(hash, info);
}
bool ftServer::FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, uint32_t flags, const std::list<std::string>& srcIds)
{
std::string error_string ;

View file

@ -120,6 +120,7 @@ ftController *getController() const { return mFtController ; }
/***
* Control of Downloads
***/
virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info);
virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, uint32_t flags, const std::list<std::string>& srcIds);
virtual bool FileCancel(const std::string& hash);
virtual bool FileControl(const std::string& hash, uint32_t flags);

View file

@ -111,6 +111,7 @@ class RsFiles
* Control of Downloads.
***/
virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info) = 0;
/// Returns false is we already have the file. Otherwise, initiates the dl and returns true.
virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, uint32_t flags, const std::list<std::string>& srcIds) = 0;
virtual bool FileCancel(const std::string& hash) = 0;

View file

@ -338,7 +338,14 @@ bool p3Channels::channelExtraFileHash(std::string path, std::string chId, FileIn
bool p3Channels::cpyMsgFileToChFldr(std::string path, std::string fname, std::string chId, bool& fileTooLarge){
FILE *outFile = NULL, *inFile = fopen(path.c_str(), "rb");
FILE *outFile = NULL, *inFile;
#ifdef WINDOWS_SYS
std::wstring wpath;
librs::util::ConvertUtf8ToUtf16(path, wpath);
inFile = _wfopen(wpath.c_str(), L"rb");
#else
inFile = fopen(path.c_str(), "rb");
#endif
long buffSize = 0;
char* buffer = NULL;
@ -370,7 +377,13 @@ bool p3Channels::cpyMsgFileToChFldr(std::string path, std::string fname, std::st
fclose(inFile);
std::string localpath = mChannelsDir + "/" + chId + "/" + fname;
#ifdef WINDOWS_SYS
std::wstring wlocalpath;
librs::util::ConvertUtf8ToUtf16(localpath, wlocalpath);
outFile = _wfopen(wlocalpath.c_str(), L"wb");
#else
outFile = fopen(localpath.c_str(), "wb");
#endif
}
if(outFile){