fixed flags conflicts

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5758 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-02 13:52:29 +00:00
parent dc82cee700
commit e753f22909
43 changed files with 383 additions and 386 deletions

View file

@ -37,7 +37,7 @@ ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3
return;
}
bool ftFiStore::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
bool ftFiStore::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{
/* could use hintflags to specify which bits of fileinfo to use additionally.
eg. hintflags & FT_SEARCH_PEER_ID, then only return matching peers + hash.
@ -128,12 +128,12 @@ ftFiMonitor::ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cached
return;
}
bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
bool ftFiMonitor::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{
std::cerr << "(EE) ********* ftFiMonitor expects a peer id in search()!" << std::endl;
return false ;
}
bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, const std::string& peer_id,FileInfo &info) const
bool ftFiMonitor::search(const std::string &hash, FileSearchFlags hintflags, const std::string& peer_id,FileInfo &info) const
{
uint64_t fsize;
std::string path;
@ -147,7 +147,8 @@ bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, const std:
// Setup search flags according to hintflags. Originally flags was 0. I (cyril) don't know
// why we don't just pass hintflags there, so I tried to keep the idea.
//
uint32_t flags = hintflags & (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE);
FileSearchFlags flags = hintflags ;
flags &= (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE);
if(findLocalFile(hash, flags,peer_id,path, fsize))
{
@ -246,7 +247,7 @@ bool ftFiMonitor::saveList(bool &cleanup, std::list<RsItem *>& sList)
RsFileConfigItem *fi = new RsFileConfigItem();
fi->file.path = (*it).filename ;
fi->file.name = (*it).virtualname ;
fi->flags = (*it).shareflags ;
fi->flags = (*it).shareflags.toUInt32() ;
sList.push_back(fi);
}
@ -293,7 +294,7 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
/* for each item, check it exists ....
* - remove any that are dead (or flag?)
*/
static const uint32_t PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
#ifdef DEBUG_ELIST
std::cerr << "ftFiMonitor::loadList()";
@ -347,7 +348,8 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
SharedDirInfo info ;
info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
info.virtualname = fi->file.name;
info.shareflags = fi->flags & PERMISSION_MASK ;
info.shareflags = FileStorageFlags(fi->flags) ;
info.shareflags &= PERMISSION_MASK ;
dirList.push_back(info) ;
}
@ -359,6 +361,11 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
void ftFiMonitor::updateShareFlags(const SharedDirInfo& info)
{
std::cerr << "Updating share flags:" << std::endl;
std::cerr << " Directory : " << info.filename << std::endl;
std::cerr << " Virtual : " << info.virtualname << std::endl;
std::cerr << " Flags : " << info.shareflags << std::endl;
FileIndexMonitor::updateShareFlags(info);
/* flag for config */
@ -382,7 +389,7 @@ ftCacheStrapper::ftCacheStrapper(p3LinkMgr *lm)
}
/* overloaded search function */
bool ftCacheStrapper::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const
bool ftCacheStrapper::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{
/* remove unused parameter warnings */
(void) hintflags;