mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
finished conversion to RsNodeGroupId for file transfer and GUI
This commit is contained in:
parent
4ee9effc4e
commit
01c0d2f0f1
@ -431,7 +431,7 @@ int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<D
|
||||
return !results.empty() ;
|
||||
}
|
||||
|
||||
bool FileIndexMonitor::findLocalFile(const RsFileHash& hash,FileSearchFlags hint_flags, const RsPeerId& peer_id,std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<std::string>& parent_groups) const
|
||||
bool FileIndexMonitor::findLocalFile(const RsFileHash& hash,FileSearchFlags hint_flags, const RsPeerId& peer_id,std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<RsNodeGroupId>& parent_groups) const
|
||||
{
|
||||
std::list<FileEntry *> results;
|
||||
bool ok = false;
|
||||
@ -1668,7 +1668,7 @@ int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, FileSear
|
||||
return true ;
|
||||
}
|
||||
|
||||
void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<std::string>& parent_groups) const
|
||||
void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<RsNodeGroupId>& parent_groups) const
|
||||
{
|
||||
flags.clear() ;
|
||||
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
||||
|
@ -110,7 +110,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
||||
virtual ~FileIndexMonitor();
|
||||
|
||||
/* external interface for filetransfer */
|
||||
bool findLocalFile(const RsFileHash& hash,FileSearchFlags flags,const RsPeerId& peer_id, std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<std::string>& parent_groups) const;
|
||||
bool findLocalFile(const RsFileHash& hash,FileSearchFlags flags,const RsPeerId& peer_id, std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<RsNodeGroupId>& parent_groups) const;
|
||||
|
||||
int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
||||
int SearchBoolExp(Expression *exp, std::list<DirDetails> &results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
||||
@ -176,7 +176,7 @@ class FileIndexMonitor: public CacheSource, public RsTickingThread
|
||||
time_t locked_saveFileIndexes(bool update_cache) ;
|
||||
|
||||
// Finds the share flags associated with this file entry.
|
||||
void locked_findShareFlagsAndParentGroups(FileEntry *fe,FileStorageFlags& shareflags,std::list<std::string>& parent_groups) const ;
|
||||
void locked_findShareFlagsAndParentGroups(FileEntry *fe, FileStorageFlags& shareflags, std::list<RsNodeGroupId> &parent_groups) const ;
|
||||
|
||||
std::string locked_findRealRoot(std::string base) const;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "ft/ftdbase.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
||||
@ -237,11 +238,13 @@ bool ftFiMonitor::saveList(bool &cleanup, std::list<RsItem *>& sList)
|
||||
|
||||
for(it = dirList.begin(); it != dirList.end(); ++it)
|
||||
{
|
||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
||||
fi->file.path = (*it).filename ;
|
||||
fi->file.name = (*it).virtualname ;
|
||||
fi->flags = (*it).shareflags.toUInt32() ;
|
||||
fi->parent_groups = (*it).parent_groups ;
|
||||
|
||||
for(std::list<RsNodeGroupId>::const_iterator it2( (*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2)
|
||||
fi->parent_groups.ids.insert(*it2) ;
|
||||
|
||||
sList.push_back(fi);
|
||||
}
|
||||
@ -332,25 +335,53 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
|
||||
continue ;
|
||||
}
|
||||
|
||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
||||
if (!fi)
|
||||
{
|
||||
delete (*it);
|
||||
continue;
|
||||
}
|
||||
// 07/05/2016 - This ensures backward compatibility. Can be removed in a few weeks.
|
||||
RsFileConfigItem_deprecated *fib = dynamic_cast<RsFileConfigItem_deprecated *>(*it);
|
||||
if (fib)
|
||||
{
|
||||
/* ensure that it exists? */
|
||||
|
||||
/* ensure that it exists? */
|
||||
SharedDirInfo info ;
|
||||
info.filename = RsDirUtil::convertPathToUnix(fib->file.path);
|
||||
info.virtualname = fib->file.name;
|
||||
info.shareflags = FileStorageFlags(fib->flags) ;
|
||||
info.shareflags &= PERMISSION_MASK ;
|
||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||
|
||||
SharedDirInfo info ;
|
||||
info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
|
||||
info.virtualname = fi->file.name;
|
||||
info.parent_groups = fi->parent_groups;
|
||||
info.shareflags = FileStorageFlags(fi->flags) ;
|
||||
info.shareflags &= PERMISSION_MASK ;
|
||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||
for(std::list<std::string>::const_iterator itt(fib->parent_groups.begin());itt!=fib->parent_groups.end();++itt)
|
||||
{
|
||||
RsGroupInfo ginfo;
|
||||
|
||||
if(rsPeers->getGroupInfoByName(*itt,ginfo) )
|
||||
{
|
||||
info.parent_groups.push_back(ginfo.id) ;
|
||||
std::cerr << "(II) converted old group ID \"" << *itt << "\" into corresponding new group id " << ginfo.id << std::endl;
|
||||
}
|
||||
else
|
||||
std::cerr << "(EE) cannot convert old group ID \"" << *itt << "\" into corresponding new group id: no candidate found. " << std::endl;
|
||||
}
|
||||
|
||||
dirList.push_back(info) ;
|
||||
}
|
||||
|
||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
||||
if (fi)
|
||||
{
|
||||
/* ensure that it exists? */
|
||||
|
||||
SharedDirInfo info ;
|
||||
info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
|
||||
info.virtualname = fi->file.name;
|
||||
info.shareflags = FileStorageFlags(fi->flags) ;
|
||||
info.shareflags &= PERMISSION_MASK ;
|
||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
||||
|
||||
for(std::set<RsNodeGroupId>::const_iterator itt(fi->parent_groups.ids.begin());itt!=fi->parent_groups.ids.end();++itt)
|
||||
info.parent_groups.push_back(*itt) ;
|
||||
|
||||
dirList.push_back(info) ;
|
||||
}
|
||||
|
||||
dirList.push_back(info) ;
|
||||
|
||||
delete *it ;
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ bool ftExtraList::saveList(bool &cleanup, std::list<RsItem *>& sList)
|
||||
std::map<RsFileHash, FileDetails>::const_iterator it;
|
||||
for(it = mFiles.begin(); it != mFiles.end(); ++it)
|
||||
{
|
||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
||||
RsFileConfigItem_deprecated *fi = new RsFileConfigItem_deprecated();
|
||||
fi->file.path = (it->second).info.path;
|
||||
fi->file.name = (it->second).info.fname;
|
||||
fi->file.hash = (it->second).info.hash;
|
||||
@ -428,7 +428,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
for(it = load.begin(); it != load.end(); ++it)
|
||||
{
|
||||
|
||||
RsFileConfigItem *fi = dynamic_cast<RsFileConfigItem *>(*it);
|
||||
RsFileConfigItem_deprecated *fi = dynamic_cast<RsFileConfigItem_deprecated *>(*it);
|
||||
if (!fi)
|
||||
{
|
||||
delete (*it);
|
||||
|
@ -2575,6 +2575,19 @@ bool p3PeerMgrIMPL::removeGroup(const RsNodeGroupId& groupId)
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool p3PeerMgrIMPL::getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo)
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
for(std::map<RsNodeGroupId,RsGroupInfo>::iterator it = groupList.begin();it!=groupList.end();++it)
|
||||
if(it->second.name == groupName)
|
||||
{
|
||||
groupInfo = it->second ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
bool p3PeerMgrIMPL::getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo &groupInfo)
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
@ -142,6 +142,7 @@ virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool removeGroup(const RsNodeGroupId &groupId) = 0;
|
||||
virtual bool getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
|
||||
virtual bool assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
||||
|
||||
@ -256,6 +257,7 @@ public:
|
||||
virtual bool editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||
virtual bool removeGroup(const RsNodeGroupId &groupId);
|
||||
virtual bool getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo) ;
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
||||
virtual bool assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId> &peerIds, bool assign);
|
||||
|
||||
|
@ -99,7 +99,7 @@ struct SharedDirInfo
|
||||
std::string filename ;
|
||||
std::string virtualname ;
|
||||
FileStorageFlags shareflags ; // DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | ...
|
||||
std::list<std::string> parent_groups ;
|
||||
std::list<RsNodeGroupId> parent_groups ;
|
||||
};
|
||||
|
||||
class RsFiles
|
||||
|
@ -409,6 +409,7 @@ public:
|
||||
virtual bool editGroup(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool removeGroup(const RsNodeGroupId& groupId) = 0;
|
||||
virtual bool getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool getGroupInfoByName(const std::string& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo>& groupInfoList) = 0;
|
||||
// groupId == "" && assign == false -> remove from all groups
|
||||
virtual bool assignPeerToGroup(const RsNodeGroupId& groupId, const RsPgpId& peerId, bool assign) = 0;
|
||||
@ -427,7 +428,7 @@ public:
|
||||
//
|
||||
virtual FileSearchFlags computePeerPermissionFlags(
|
||||
const RsPeerId& peer_id, FileStorageFlags file_sharing_flags,
|
||||
const std::list<std::string>& file_parent_groups) = 0;
|
||||
const std::list<RsNodeGroupId>& file_parent_groups) = 0;
|
||||
|
||||
/* Service permission flags */
|
||||
|
||||
|
@ -211,7 +211,7 @@ class FileInfo
|
||||
DwlSpeed priority ;
|
||||
time_t lastTS;
|
||||
|
||||
std::list<std::string> parent_groups ;
|
||||
std::list<RsNodeGroupId> parent_groups ;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const FileInfo &info);
|
||||
@ -243,7 +243,7 @@ class DirDetails
|
||||
uint32_t min_age ; // minimum age of files in this subtree
|
||||
|
||||
std::list<DirStub> children;
|
||||
std::list<std::string> parent_groups; // parent groups for the shared directory
|
||||
std::list<RsNodeGroupId> parent_groups; // parent groups for the shared directory
|
||||
};
|
||||
|
||||
class FileDetail
|
||||
|
@ -1303,6 +1303,14 @@ bool p3Peers::removeGroup(const RsNodeGroupId &groupId)
|
||||
return res ;
|
||||
}
|
||||
|
||||
bool p3Peers::getGroupInfoByName(const std::string& groupName, RsGroupInfo &groupInfo)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::getGroupInfo()" << std::endl;
|
||||
#endif
|
||||
|
||||
return mPeerMgr->getGroupInfoByName(groupName, groupInfo);
|
||||
}
|
||||
bool p3Peers::getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
@ -1343,7 +1351,7 @@ bool p3Peers::assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<R
|
||||
|
||||
FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
||||
FileStorageFlags share_flags,
|
||||
const std::list<std::string>& directory_parent_groups)
|
||||
const std::list<RsNodeGroupId>& directory_parent_groups)
|
||||
{
|
||||
// We should be able to do that in O(1), using groups based on packs of bits.
|
||||
//
|
||||
@ -1354,7 +1362,7 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
||||
bool found = false ;
|
||||
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
||||
for(std::list<RsNodeGroupId>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
||||
{
|
||||
RsGroupInfo info ;
|
||||
if(!getGroupInfo(*it,info))
|
||||
|
@ -127,11 +127,12 @@ public:
|
||||
virtual bool editGroup(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||
virtual bool removeGroup(const RsNodeGroupId &groupId);
|
||||
virtual bool getGroupInfo(const RsNodeGroupId &groupId, RsGroupInfo &groupInfo);
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
||||
virtual bool getGroupInfoByName(const std::string& groupName, RsGroupInfo& groupInfo);
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
|
||||
virtual bool assignPeerToGroup(const RsNodeGroupId &groupId, const RsPgpId &peerId, bool assign);
|
||||
virtual bool assignPeersToGroup(const RsNodeGroupId &groupId, const std::list<RsPgpId>& peerIds, bool assign);
|
||||
|
||||
virtual FileSearchFlags computePeerPermissionFlags(const RsPeerId& peer_id,FileStorageFlags share_flags,const std::list<std::string>& parent_groups);
|
||||
virtual FileSearchFlags computePeerPermissionFlags(const RsPeerId& peer_id, FileStorageFlags share_flags, const std::list<RsNodeGroupId> &parent_groups);
|
||||
|
||||
// service permission stuff
|
||||
|
||||
|
@ -43,34 +43,34 @@
|
||||
uint32_t RsFileConfigSerialiser::size(RsItem *i)
|
||||
{
|
||||
RsFileTransfer *rft;
|
||||
RsFileConfigItem *rfi;
|
||||
RsFileConfigItem *rfj;
|
||||
|
||||
if (NULL != (rft = dynamic_cast<RsFileTransfer *>(i)))
|
||||
{
|
||||
return sizeTransfer(rft);
|
||||
}
|
||||
if (NULL != (rfi = dynamic_cast<RsFileConfigItem *>(i)))
|
||||
{
|
||||
return sizeFileItem(rfi);
|
||||
}
|
||||
return 0;
|
||||
if (NULL != (rfj = dynamic_cast<RsFileConfigItem *>(i)))
|
||||
{
|
||||
return sizeFileItem(rfj);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* serialise the data to the buffer */
|
||||
bool RsFileConfigSerialiser::serialise(RsItem *i, void *data, uint32_t *pktsize)
|
||||
{
|
||||
RsFileTransfer *rft;
|
||||
RsFileConfigItem *rfi;
|
||||
RsFileConfigItem *rfj;
|
||||
|
||||
if (NULL != (rft = dynamic_cast<RsFileTransfer *>(i)))
|
||||
{
|
||||
return serialiseTransfer(rft, data, pktsize);
|
||||
}
|
||||
if (NULL != (rfi = dynamic_cast<RsFileConfigItem *>(i)))
|
||||
{
|
||||
return serialiseFileItem(rfi, data, pktsize);
|
||||
}
|
||||
return false;
|
||||
if (NULL != (rfj = dynamic_cast<RsFileConfigItem*>(i)))
|
||||
{
|
||||
return serialiseFileItem(rfj, data, pktsize);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RsItem *RsFileConfigSerialiser::deserialise(void *data, uint32_t *pktsize)
|
||||
@ -90,10 +90,13 @@ RsItem *RsFileConfigSerialiser::deserialise(void *data, uint32_t *pktsize)
|
||||
case RS_PKT_SUBTYPE_FILE_TRANSFER:
|
||||
return deserialiseTransfer(data, pktsize);
|
||||
break;
|
||||
case RS_PKT_SUBTYPE_FILE_ITEM:
|
||||
return deserialiseFileItem(data, pktsize);
|
||||
case RS_PKT_SUBTYPE_FILE_ITEM_deprecated:
|
||||
return deserialiseFileItem_deprecated(data, pktsize);
|
||||
break;
|
||||
default:
|
||||
case RS_PKT_SUBTYPE_FILE_ITEM:
|
||||
return deserialiseFileItem(data, pktsize);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
@ -158,20 +161,20 @@ std::ostream &RsFileTransfer::print(std::ostream &out, uint16_t indent)
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
RsFileConfigItem::~RsFileConfigItem()
|
||||
void RsFileConfigItem_deprecated::clear()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void RsFileConfigItem::clear()
|
||||
{
|
||||
|
||||
file.TlvClear();
|
||||
flags = 0;
|
||||
parent_groups.clear() ;
|
||||
}
|
||||
|
||||
std::ostream &RsFileConfigItem::print(std::ostream &out, uint16_t indent)
|
||||
void RsFileConfigItem::clear()
|
||||
{
|
||||
file.TlvClear();
|
||||
flags = 0;
|
||||
parent_groups.TlvClear() ;
|
||||
}
|
||||
std::ostream &RsFileConfigItem_deprecated::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsFileConfigItem", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
@ -188,6 +191,22 @@ std::ostream &RsFileConfigItem::print(std::ostream &out, uint16_t indent)
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &RsFileConfigItem::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printRsItemBase(out, "RsFileConfigItem", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
file.print(out, int_Indent);
|
||||
|
||||
printIndent(out, int_Indent); out << "flags: " << flags << std::endl;
|
||||
printIndent(out, int_Indent); out << "groups:" ;
|
||||
|
||||
for(std::set<RsNodeGroupId>::const_iterator it(parent_groups.ids.begin());it!=parent_groups.ids.end();++it)
|
||||
out << (*it) << " " ;
|
||||
out << std::endl;
|
||||
|
||||
printRsItemEnd(out, "RsFileConfigItem", indent);
|
||||
return out;
|
||||
}
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
@ -351,8 +370,7 @@ uint32_t RsFileConfigSerialiser::sizeFileItem(RsFileConfigItem *item)
|
||||
s += item->file.TlvSize();
|
||||
s += 4; // flags
|
||||
|
||||
for(std::list<std::string>::const_iterator it(item->parent_groups.begin());it!=item->parent_groups.end();++it) // parent groups
|
||||
s += GetTlvStringSize(*it);
|
||||
s += item->parent_groups.TlvSize() ;
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -382,9 +400,7 @@ bool RsFileConfigSerialiser::serialiseFileItem(RsFileConfigItem *item, void
|
||||
/* add mandatory parts first */
|
||||
ok &= item->file.SetTlv(data, tlvsize, &offset);
|
||||
ok &= setRawUInt32(data, tlvsize, &offset, item->flags);
|
||||
|
||||
for(std::list<std::string>::const_iterator it(item->parent_groups.begin());ok && it!=item->parent_groups.end();++it) // parent groups
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GROUPID, *it);
|
||||
ok &= item->parent_groups.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
if (offset != tlvsize)
|
||||
{
|
||||
@ -397,6 +413,66 @@ bool RsFileConfigSerialiser::serialiseFileItem(RsFileConfigItem *item, void
|
||||
return ok;
|
||||
}
|
||||
|
||||
RsFileConfigItem_deprecated *RsFileConfigSerialiser::deserialiseFileItem_deprecated(void *data, uint32_t *pktsize)
|
||||
{
|
||||
/* get the type and size */
|
||||
uint32_t rstype = getRsItemId(data);
|
||||
uint32_t rssize = getRsItemSize(data);
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
|
||||
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
|
||||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
|
||||
(RS_PKT_TYPE_FILE_CONFIG != getRsItemType(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_FILE_ITEM_deprecated != getRsItemSubType(rstype)))
|
||||
{
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
|
||||
if (*pktsize < rssize) /* check size */
|
||||
return NULL; /* not enough data */
|
||||
|
||||
/* set the packet length */
|
||||
*pktsize = rssize;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
/* ready to load */
|
||||
RsFileConfigItem_deprecated *item = new RsFileConfigItem_deprecated();
|
||||
item->clear();
|
||||
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* get mandatory parts first */
|
||||
ok &= item->file.GetTlv(data, rssize, &offset);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &(item->flags));
|
||||
|
||||
while(offset < rssize)
|
||||
{
|
||||
std::string tmp ;
|
||||
if(GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GROUPID, tmp))
|
||||
item->parent_groups.push_back(tmp) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
/* error */
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
delete item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
RsFileConfigItem *RsFileConfigSerialiser::deserialiseFileItem(void *data, uint32_t *pktsize)
|
||||
{
|
||||
/* get the type and size */
|
||||
@ -409,7 +485,7 @@ RsFileConfigItem *RsFileConfigSerialiser::deserialiseFileItem(void *data, uint32
|
||||
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
|
||||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
|
||||
(RS_PKT_TYPE_FILE_CONFIG != getRsItemType(rstype)) ||
|
||||
(RS_PKT_SUBTYPE_FILE_ITEM != getRsItemSubType(rstype)))
|
||||
(RS_PKT_SUBTYPE_FILE_ITEM_deprecated != getRsItemSubType(rstype)))
|
||||
{
|
||||
return NULL; /* wrong type */
|
||||
}
|
||||
@ -423,7 +499,7 @@ RsFileConfigItem *RsFileConfigSerialiser::deserialiseFileItem(void *data, uint32
|
||||
bool ok = true;
|
||||
|
||||
/* ready to load */
|
||||
RsFileConfigItem *item = new RsFileConfigItem();
|
||||
RsFileConfigItem *item = new RsFileConfigItem();
|
||||
item->clear();
|
||||
|
||||
/* skip the header */
|
||||
@ -432,15 +508,7 @@ RsFileConfigItem *RsFileConfigSerialiser::deserialiseFileItem(void *data, uint32
|
||||
/* get mandatory parts first */
|
||||
ok &= item->file.GetTlv(data, rssize, &offset);
|
||||
ok &= getRawUInt32(data, rssize, &offset, &(item->flags));
|
||||
|
||||
while(offset < rssize)
|
||||
{
|
||||
std::string tmp ;
|
||||
if(GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GROUPID, tmp))
|
||||
item->parent_groups.push_back(tmp) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
ok &= item->parent_groups.GetTlv(data, rssize, &offset) ;
|
||||
|
||||
if (offset != rssize)
|
||||
{
|
||||
@ -1316,6 +1384,15 @@ RsNodeGroupItem::RsNodeGroupItem() : RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG
|
||||
{
|
||||
}
|
||||
|
||||
RsNodeGroupItem::RsNodeGroupItem(const RsGroupInfo& g)
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PEER_CONFIG, RS_PKT_SUBTYPE_NODE_GROUP)
|
||||
{
|
||||
id = g.id ;
|
||||
name = g.name ;
|
||||
flag = g.flag ;
|
||||
pgpList.ids = g.peerIds;
|
||||
}
|
||||
|
||||
void RsNodeGroupItem::clear()
|
||||
{
|
||||
id.clear();
|
||||
@ -1348,23 +1425,6 @@ std::ostream &RsNodeGroupItem::print(std::ostream &out, uint16_t indent)
|
||||
return out;
|
||||
}
|
||||
|
||||
/* set data from RsGroupInfo to RsPeerGroupItem */
|
||||
void RsNodeGroupItem::set(RsGroupInfo &groupInfo)
|
||||
{
|
||||
id = groupInfo.id;
|
||||
name = groupInfo.name;
|
||||
flag = groupInfo.flag;
|
||||
pgpList.ids = groupInfo.peerIds;
|
||||
}
|
||||
|
||||
/* get data from RsGroupInfo to RsPeerGroupItem */
|
||||
void RsNodeGroupItem::get(RsGroupInfo &groupInfo)
|
||||
{
|
||||
groupInfo.id = id;
|
||||
groupInfo.name = name;
|
||||
groupInfo.flag = flag;
|
||||
groupInfo.peerIds = pgpList.ids;
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* DEPRECATED CODE. SHOULD BE REMOVED WHEN EVERYONE USES THE NEW CLASS */
|
||||
/*************************************************************************/
|
||||
@ -1409,24 +1469,6 @@ std::ostream &RsPeerGroupItem_deprecated::print(std::ostream &out, uint16_t inde
|
||||
return out;
|
||||
}
|
||||
|
||||
/* set data from RsGroupInfo to RsPeerGroupItem */
|
||||
void RsPeerGroupItem_deprecated::set(RsGroupInfo &groupInfo)
|
||||
{
|
||||
id = groupInfo.id;
|
||||
name = groupInfo.name;
|
||||
flag = groupInfo.flag;
|
||||
pgpList.ids = groupInfo.peerIds;
|
||||
}
|
||||
|
||||
/* get data from RsGroupInfo to RsPeerGroupItem */
|
||||
void RsPeerGroupItem_deprecated::get(RsGroupInfo &groupInfo)
|
||||
{
|
||||
groupInfo.id = id;
|
||||
groupInfo.name = name;
|
||||
groupInfo.flag = flag;
|
||||
groupInfo.peerIds = pgpList.ids;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
uint32_t RsPeerConfigSerialiser::sizeGroup(RsPeerGroupItem_deprecated *i)
|
||||
|
@ -58,8 +58,9 @@ const uint8_t RS_PKT_SUBTYPE_PEER_BANDLIMITS = 0x06;
|
||||
const uint8_t RS_PKT_SUBTYPE_NODE_GROUP = 0x07;
|
||||
|
||||
/* FILE CONFIG SUBTYPES */
|
||||
const uint8_t RS_PKT_SUBTYPE_FILE_TRANSFER = 0x01;
|
||||
const uint8_t RS_PKT_SUBTYPE_FILE_ITEM = 0x02;
|
||||
const uint8_t RS_PKT_SUBTYPE_FILE_TRANSFER = 0x01;
|
||||
const uint8_t RS_PKT_SUBTYPE_FILE_ITEM_deprecated = 0x02;
|
||||
const uint8_t RS_PKT_SUBTYPE_FILE_ITEM = 0x03;
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
@ -327,23 +328,39 @@ class RsFileTransfer: public RsItem
|
||||
const uint32_t RS_FILE_CONFIG_CLEANUP_DELETE = 0x0001;
|
||||
|
||||
/* Used by ft / extralist / configdirs / anyone who wants a basic file */
|
||||
class RsFileConfigItem: public RsItem
|
||||
class RsFileConfigItem_deprecated: public RsItem
|
||||
{
|
||||
public:
|
||||
RsFileConfigItem()
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
|
||||
RS_PKT_TYPE_FILE_CONFIG,
|
||||
RS_PKT_SUBTYPE_FILE_ITEM)
|
||||
{ return; }
|
||||
virtual ~RsFileConfigItem();
|
||||
virtual void clear();
|
||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
public:
|
||||
RsFileConfigItem_deprecated()
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
|
||||
RS_PKT_TYPE_FILE_CONFIG,
|
||||
RS_PKT_SUBTYPE_FILE_ITEM_deprecated)
|
||||
{}
|
||||
virtual ~RsFileConfigItem_deprecated() {}
|
||||
virtual void clear();
|
||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
RsTlvFileItem file;
|
||||
uint32_t flags;
|
||||
std::list<std::string> parent_groups ;
|
||||
RsTlvFileItem file;
|
||||
uint32_t flags;
|
||||
std::list<std::string> parent_groups ;
|
||||
};
|
||||
|
||||
class RsFileConfigItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsFileConfigItem()
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
|
||||
RS_PKT_TYPE_FILE_CONFIG,
|
||||
RS_PKT_SUBTYPE_FILE_ITEM)
|
||||
{}
|
||||
virtual ~RsFileConfigItem() {}
|
||||
virtual void clear();
|
||||
std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
RsTlvFileItem file;
|
||||
uint32_t flags;
|
||||
RsTlvNodeGroupIdSet parent_groups ;
|
||||
};
|
||||
/**************************************************************************/
|
||||
|
||||
class RsFileConfigSerialiser: public RsSerialType
|
||||
@ -365,9 +382,11 @@ virtual uint32_t sizeTransfer(RsFileTransfer *);
|
||||
virtual bool serialiseTransfer(RsFileTransfer *item, void *data, uint32_t *size);
|
||||
virtual RsFileTransfer * deserialiseTransfer(void *data, uint32_t *size);
|
||||
|
||||
virtual RsFileConfigItem_deprecated * deserialiseFileItem_deprecated(void *data, uint32_t *size);
|
||||
|
||||
virtual uint32_t sizeFileItem(RsFileConfigItem *);
|
||||
virtual bool serialiseFileItem(RsFileConfigItem *item, void *data, uint32_t *size);
|
||||
virtual RsFileConfigItem * deserialiseFileItem(void *data, uint32_t *size);
|
||||
virtual RsFileConfigItem *deserialiseFileItem(void *data, uint32_t *size);
|
||||
|
||||
};
|
||||
|
||||
|
@ -204,7 +204,7 @@ const uint16_t TLV_TYPE_PGPIDSET = 0x1023;
|
||||
const uint16_t TLV_TYPE_RECOGNSET = 0x1024;
|
||||
const uint16_t TLV_TYPE_GXSIDSET = 0x1025;
|
||||
const uint16_t TLV_TYPE_GXSCIRCLEIDSET= 0x1026;
|
||||
const uint16_t TLV_TYPE_GXSGROUPIDSET = 0x1027;
|
||||
const uint16_t TLV_TYPE_NODEGROUPIDSET= 0x1027;
|
||||
|
||||
const uint16_t TLV_TYPE_SERVICESET = 0x1030;
|
||||
|
||||
|
@ -120,7 +120,7 @@ typedef t_RsTlvIdSet<RsPgpId, TLV_TYPE_PGPIDSET> RsTlvPgpIdSet ;
|
||||
typedef t_RsTlvIdSet<Sha1CheckSum, TLV_TYPE_HASHSET> RsTlvHashSet ;
|
||||
typedef t_RsTlvIdSet<RsGxsId, TLV_TYPE_GXSIDSET> RsTlvGxsIdSet ;
|
||||
typedef t_RsTlvIdSet<RsGxsCircleId,TLV_TYPE_GXSCIRCLEIDSET> RsTlvGxsCircleIdSet ;
|
||||
typedef t_RsTlvIdSet<RsGxsGroupId, TLV_TYPE_GXSGROUPIDSET> RsTlvGxsGroupIdSet ;
|
||||
typedef t_RsTlvIdSet<RsNodeGroupId,TLV_TYPE_NODEGROUPIDSET> RsTlvNodeGroupIdSet ;
|
||||
|
||||
class RsTlvServiceIdSet: public RsTlvItem
|
||||
{
|
||||
|
@ -56,8 +56,9 @@
|
||||
*****/
|
||||
|
||||
MessengerWindow* MessengerWindow::_instance = NULL;
|
||||
static std::set<std::string> *expandedPeers = NULL;
|
||||
static std::set<std::string> *expandedGroups = NULL;
|
||||
|
||||
std::set<std::string> MessengerWindow::expandedPeers ;
|
||||
std::set<RsNodeGroupId> MessengerWindow::expandedGroups ;
|
||||
|
||||
/*static*/ void MessengerWindow::showYourself ()
|
||||
{
|
||||
@ -79,16 +80,6 @@ void MessengerWindow::releaseInstance()
|
||||
if (_instance) {
|
||||
delete _instance;
|
||||
}
|
||||
if (expandedPeers) {
|
||||
/* delete saved expanded peers */
|
||||
delete(expandedPeers);
|
||||
expandedPeers = NULL;
|
||||
}
|
||||
if (expandedGroups) {
|
||||
/* delete saved expanded groups */
|
||||
delete(expandedGroups);
|
||||
expandedGroups = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/** Constructor */
|
||||
@ -108,21 +99,15 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
|
||||
|
||||
if (expandedPeers != NULL) {
|
||||
for (std::set<std::string>::iterator peerIt = expandedPeers->begin(); peerIt != expandedPeers->end(); ++peerIt) {
|
||||
for (std::set<std::string>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
|
||||
ui.friendList->addPeerToExpand(*peerIt);
|
||||
}
|
||||
delete expandedPeers;
|
||||
expandedPeers = NULL;
|
||||
}
|
||||
expandedPeers.clear();
|
||||
|
||||
if (expandedGroups != NULL) {
|
||||
for (std::set<std::string>::iterator groupIt = expandedGroups->begin(); groupIt != expandedGroups->end(); ++groupIt) {
|
||||
for (std::set<RsNodeGroupId>::iterator groupIt = expandedGroups.begin(); groupIt != expandedGroups.end(); ++groupIt) {
|
||||
ui.friendList->addGroupToExpand(*groupIt);
|
||||
}
|
||||
delete expandedGroups;
|
||||
expandedGroups = NULL;
|
||||
}
|
||||
expandedGroups.clear();
|
||||
|
||||
ui.messagelineEdit->setMinimumWidth(20);
|
||||
|
||||
@ -203,22 +188,12 @@ void MessengerWindow::addFriend()
|
||||
void MessengerWindow::closeEvent (QCloseEvent * /*event*/)
|
||||
{
|
||||
/* save the expanded peers */
|
||||
if (expandedPeers == NULL) {
|
||||
expandedPeers = new std::set<std::string>;
|
||||
} else {
|
||||
expandedPeers->clear();
|
||||
}
|
||||
|
||||
ui.friendList->getExpandedPeers(*expandedPeers);
|
||||
expandedPeers.clear();
|
||||
ui.friendList->getExpandedPeers(expandedPeers);
|
||||
|
||||
/* save the expanded groups */
|
||||
if (expandedGroups == NULL) {
|
||||
expandedGroups = new std::set<std::string>;
|
||||
} else {
|
||||
expandedGroups->clear();
|
||||
}
|
||||
|
||||
ui.friendList->getExpandedGroups(*expandedGroups);
|
||||
expandedGroups.clear();
|
||||
ui.friendList->getExpandedGroups(expandedGroups);
|
||||
}
|
||||
|
||||
/** Shows Share Manager */
|
||||
|
@ -66,6 +66,9 @@ private:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MessengerWindow ui;
|
||||
|
||||
static std::set<std::string> expandedPeers ;
|
||||
static std::set<RsNodeGroupId> expandedGroups ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -212,12 +212,12 @@ QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
|
||||
|
||||
return QString(str) ;
|
||||
}
|
||||
QString RetroshareDirModel::getGroupsString(const std::list<std::string>& group_ids)
|
||||
QString RetroshareDirModel::getGroupsString(const std::list<RsNodeGroupId>& group_ids)
|
||||
{
|
||||
QString groups_str ;
|
||||
RsGroupInfo group_info ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it(group_ids.begin());it!=group_ids.end();)
|
||||
for(std::list<RsNodeGroupId>::const_iterator it(group_ids.begin());it!=group_ids.end();)
|
||||
if(rsPeers->getGroupInfo(*it,group_info))
|
||||
{
|
||||
groups_str += GroupDefs::name(group_info) ;
|
||||
|
@ -91,7 +91,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
||||
void treeStyle();
|
||||
void downloadDirectory(const DirDetails & details, int prefixLen);
|
||||
static QString getFlagsString(FileStorageFlags f) ;
|
||||
static QString getGroupsString(const std::list<std::string>&) ;
|
||||
static QString getGroupsString(const std::list<RsNodeGroupId> &) ;
|
||||
QString getAgeIndicatorString(const DirDetails &) const;
|
||||
// void getAgeIndicatorRec(const DirDetails &details, QString &ret) const;
|
||||
|
||||
|
@ -249,7 +249,7 @@ void ShareManager::updateGroups()
|
||||
|
||||
QString group_string;
|
||||
int n = 0;
|
||||
for (std::list<std::string>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
|
||||
for (std::list<RsNodeGroupId>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
|
||||
{
|
||||
if (n>0)
|
||||
group_string += ", " ;
|
||||
|
@ -116,9 +116,7 @@ FriendList::FriendList(QWidget *parent) :
|
||||
mShowGroups(true),
|
||||
mShowState(false),
|
||||
mHideUnconnected(false),
|
||||
groupsHasChanged(false),
|
||||
openGroups(NULL),
|
||||
openPeers(NULL)
|
||||
groupsHasChanged(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -219,7 +217,7 @@ void FriendList::processSettings(bool load)
|
||||
int arrayIndex = Settings->beginReadArray("Groups");
|
||||
for (int index = 0; index < arrayIndex; ++index) {
|
||||
Settings->setArrayIndex(index);
|
||||
addGroupToExpand(Settings->value("open").toString().toStdString());
|
||||
addGroupToExpand(RsNodeGroupId(Settings->value("open").toString().toStdString()));
|
||||
}
|
||||
Settings->endArray();
|
||||
} else {
|
||||
@ -236,11 +234,11 @@ void FriendList::processSettings(bool load)
|
||||
// open groups
|
||||
Settings->beginWriteArray("Groups");
|
||||
int arrayIndex = 0;
|
||||
std::set<std::string> expandedPeers;
|
||||
std::set<RsNodeGroupId> expandedPeers;
|
||||
getExpandedGroups(expandedPeers);
|
||||
foreach (std::string groupId, expandedPeers) {
|
||||
foreach (RsNodeGroupId groupId, expandedPeers) {
|
||||
Settings->setArrayIndex(arrayIndex++);
|
||||
Settings->setValue("open", QString::fromStdString(groupId));
|
||||
Settings->setValue("open", QString::fromStdString(groupId.toStdString()));
|
||||
}
|
||||
Settings->endArray();
|
||||
}
|
||||
@ -369,7 +367,7 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
|
||||
addToGroupMenu = new QMenu(tr("Add to group"), &contextMnu);
|
||||
}
|
||||
QAction* addToGroupAction = new QAction(GroupDefs::name(*groupIt), addToGroupMenu);
|
||||
addToGroupAction->setData(QString::fromStdString(groupIt->id));
|
||||
addToGroupAction->setData(QString::fromStdString(groupIt->id.toStdString()));
|
||||
connect(addToGroupAction, SIGNAL(triggered()), this, SLOT(addToGroup()));
|
||||
addToGroupMenu->addAction(addToGroupAction);
|
||||
}
|
||||
@ -378,7 +376,7 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
|
||||
moveToGroupMenu = new QMenu(tr("Move to group"), &contextMnu);
|
||||
}
|
||||
QAction* moveToGroupAction = new QAction(GroupDefs::name(*groupIt), moveToGroupMenu);
|
||||
moveToGroupAction->setData(QString::fromStdString(groupIt->id));
|
||||
moveToGroupAction->setData(QString::fromStdString(groupIt->id.toStdString()));
|
||||
connect(moveToGroupAction, SIGNAL(triggered()), this, SLOT(moveToGroup()));
|
||||
moveToGroupMenu->addAction(moveToGroupAction);
|
||||
} else {
|
||||
@ -456,7 +454,7 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
|
||||
|
||||
void FriendList::createNewGroup()
|
||||
{
|
||||
CreateGroup createGrpDialog ("", this);
|
||||
CreateGroup createGrpDialog (RsNodeGroupId(), this);
|
||||
createGrpDialog.exec();
|
||||
}
|
||||
|
||||
@ -596,7 +594,7 @@ void FriendList::insertPeers()
|
||||
if (mShowGroups && groupsHasChanged) {
|
||||
if (parent) {
|
||||
if (parent->type() == TYPE_GROUP) {
|
||||
std::string groupId = getRsId(parent);
|
||||
RsNodeGroupId groupId(getRsId(parent));
|
||||
|
||||
// the parent is a group, check if the gpg id is assigned to the group
|
||||
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
|
||||
@ -630,7 +628,7 @@ void FriendList::insertPeers()
|
||||
}
|
||||
} else if (groupsHasChanged) {
|
||||
// remove deleted groups
|
||||
std::string groupId = getRsId(item);
|
||||
RsNodeGroupId groupId ( getRsId(item));
|
||||
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
|
||||
if (groupIt->id == groupId) {
|
||||
break;
|
||||
@ -671,7 +669,7 @@ void FriendList::insertPeers()
|
||||
int itemCount = peerTreeWidget->topLevelItemCount();
|
||||
for (int index = 0; index < itemCount; ++index) {
|
||||
QTreeWidgetItem *groupItemLoop = peerTreeWidget->topLevelItem(index);
|
||||
if (groupItemLoop->type() == TYPE_GROUP && getRsId(groupItemLoop) == groupInfo->id) {
|
||||
if (groupItemLoop->type() == TYPE_GROUP && RsNodeGroupId(getRsId(groupItemLoop)) == groupInfo->id) {
|
||||
groupItem = groupItemLoop;
|
||||
break;
|
||||
}
|
||||
@ -690,7 +688,7 @@ void FriendList::insertPeers()
|
||||
groupItem->setForeground(COLUMN_NAME, QBrush(textColorGroup()));
|
||||
|
||||
/* used to find back the item */
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
|
||||
groupItem->setData(COLUMN_DATA, ROLE_STANDARD, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? true : false);
|
||||
|
||||
/* Sort data */
|
||||
@ -716,7 +714,7 @@ void FriendList::insertPeers()
|
||||
}
|
||||
}
|
||||
|
||||
if (openGroups != NULL && openGroups->find(groupInfo->id) != openGroups->end()) {
|
||||
if (openGroups.find(groupInfo->id) != openGroups.end()) {
|
||||
groupItem->setExpanded(true);
|
||||
}
|
||||
|
||||
@ -1182,7 +1180,7 @@ void FriendList::insertPeers()
|
||||
gpgItem->setFont(i, gpgFont);
|
||||
}
|
||||
|
||||
if (openPeers != NULL && openPeers->find(gpgId.toStdString()) != openPeers->end()) {
|
||||
if (openPeers.find(gpgId.toStdString()) != openPeers.end()) {
|
||||
gpgItem->setExpanded(true);
|
||||
}
|
||||
}
|
||||
@ -1217,14 +1215,6 @@ void FriendList::insertPeers()
|
||||
}
|
||||
|
||||
groupsHasChanged = false;
|
||||
if (openGroups != NULL) {
|
||||
delete(openGroups);
|
||||
openGroups = NULL;
|
||||
}
|
||||
if (openPeers != NULL) {
|
||||
delete(openPeers);
|
||||
openPeers = NULL;
|
||||
}
|
||||
|
||||
ui->peerTreeWidget->resort();
|
||||
}
|
||||
@ -1232,13 +1222,13 @@ void FriendList::insertPeers()
|
||||
/**
|
||||
* Returns a list with all groupIds that are expanded
|
||||
*/
|
||||
bool FriendList::getExpandedGroups(std::set<std::string> &groups) const
|
||||
bool FriendList::getExpandedGroups(std::set<RsNodeGroupId> &groups) const
|
||||
{
|
||||
int itemCount = ui->peerTreeWidget->topLevelItemCount();
|
||||
for (int index = 0; index < itemCount; ++index) {
|
||||
QTreeWidgetItem *item = ui->peerTreeWidget->topLevelItem(index);
|
||||
if (item->type() == TYPE_GROUP && item->isExpanded()) {
|
||||
groups.insert(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString());
|
||||
groups.insert(RsNodeGroupId(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -1626,7 +1616,7 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &s
|
||||
case TYPE_GROUP:
|
||||
{
|
||||
RsGroupInfo groupInfo;
|
||||
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
|
||||
if (rsPeers->getGroupInfo(RsNodeGroupId(peerId), groupInfo)) {
|
||||
std::set<RsPgpId>::iterator gpgIt;
|
||||
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
|
||||
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
|
||||
@ -1649,10 +1639,10 @@ void FriendList::addToGroup()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
|
||||
RsPgpId gpgId ( getRsId(c));
|
||||
|
||||
if (gpgId.isNull() || groupId.empty()) {
|
||||
if (gpgId.isNull() || groupId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1675,15 +1665,15 @@ void FriendList::moveToGroup()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
|
||||
RsPgpId gpgId ( getRsId(c));
|
||||
|
||||
if (gpgId.isNull() || groupId.empty()) {
|
||||
if (gpgId.isNull() || groupId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove from all groups
|
||||
rsPeers->assignPeerToGroup("", gpgId, false);
|
||||
rsPeers->assignPeerToGroup(RsNodeGroupId(), gpgId, false);
|
||||
|
||||
// automatically expand the group, the peer is added to
|
||||
addGroupToExpand(groupId);
|
||||
@ -1704,7 +1694,7 @@ void FriendList::removeFromGroup()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
|
||||
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
|
||||
RsPgpId gpgId ( getRsId(c));
|
||||
|
||||
if (gpgId.isNull()) {
|
||||
@ -1727,14 +1717,13 @@ void FriendList::editGroup()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string groupId = getRsId(c);
|
||||
RsNodeGroupId groupId ( getRsId(c));
|
||||
|
||||
if (groupId.empty()) {
|
||||
return;
|
||||
if (!groupId.isNull())
|
||||
{
|
||||
CreateGroup editGrpDialog(groupId, this);
|
||||
editGrpDialog.exec();
|
||||
}
|
||||
|
||||
CreateGroup editGrpDialog(groupId, this);
|
||||
editGrpDialog.exec();
|
||||
}
|
||||
|
||||
void FriendList::removeGroup()
|
||||
@ -1749,13 +1738,10 @@ void FriendList::removeGroup()
|
||||
return;
|
||||
}
|
||||
|
||||
std::string groupId = getRsId(c);
|
||||
RsNodeGroupId groupId ( getRsId(c));
|
||||
|
||||
if (groupId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rsPeers->removeGroup(groupId);
|
||||
if (!groupId.isNull())
|
||||
rsPeers->removeGroup(groupId);
|
||||
}
|
||||
|
||||
void FriendList::exportFriendlistClicked()
|
||||
@ -2089,7 +2075,7 @@ bool FriendList::importFriendlist(QString &fileName, bool &errorPeers, bool &err
|
||||
// get name and flags and try to get the group ID
|
||||
std::string groupName = group.attribute("name").toStdString();
|
||||
uint32_t flag = group.attribute("flag").toInt();
|
||||
std::string groupId;
|
||||
RsNodeGroupId groupId;
|
||||
if(getOrCreateGroup(groupName, flag, groupId)) {
|
||||
// group id found!
|
||||
QDomElement pgpID = group.firstChildElement("pgpID");
|
||||
@ -2123,7 +2109,7 @@ bool FriendList::importFriendlist(QString &fileName, bool &errorPeers, bool &err
|
||||
* @param id groupd id for the given name
|
||||
* @return success or fail
|
||||
*/
|
||||
bool FriendList::getGroupIdByName(const std::string &name, std::string &id)
|
||||
bool FriendList::getGroupIdByName(const std::string &name, RsNodeGroupId &id)
|
||||
{
|
||||
std::list<RsGroupInfo> grpList;
|
||||
if(!rsPeers->getGroupInfoList(grpList))
|
||||
@ -2146,14 +2132,14 @@ bool FriendList::getGroupIdByName(const std::string &name, std::string &id)
|
||||
* @param id groupd id
|
||||
* @return success or failure
|
||||
*/
|
||||
bool FriendList::getOrCreateGroup(const std::string &name, const uint &flag, std::string &id)
|
||||
bool FriendList::getOrCreateGroup(const std::string &name, const uint &flag, RsNodeGroupId &id)
|
||||
{
|
||||
if(getGroupIdByName(name, id))
|
||||
return true;
|
||||
|
||||
// -> create one
|
||||
RsGroupInfo grp;
|
||||
grp.id = "0"; // RS will generate an ID
|
||||
grp.id.clear(); // RS will generate an ID
|
||||
grp.name = name;
|
||||
grp.flag = flag;
|
||||
|
||||
@ -2271,12 +2257,9 @@ void FriendList::filterItems(const QString &text)
|
||||
* Add a groupId to the openGroups list. These groups
|
||||
* will be expanded, when they're added to the QTreeWidget
|
||||
*/
|
||||
void FriendList::addGroupToExpand(const std::string &groupId)
|
||||
void FriendList::addGroupToExpand(const RsNodeGroupId &groupId)
|
||||
{
|
||||
if (openGroups == NULL) {
|
||||
openGroups = new std::set<std::string>;
|
||||
}
|
||||
openGroups->insert(groupId);
|
||||
openGroups.insert(groupId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2285,10 +2268,7 @@ void FriendList::addGroupToExpand(const std::string &groupId)
|
||||
*/
|
||||
void FriendList::addPeerToExpand(const std::string &gpgId)
|
||||
{
|
||||
if (openPeers == NULL) {
|
||||
openPeers = new std::set<std::string>;
|
||||
}
|
||||
openPeers->insert(gpgId);
|
||||
openPeers.insert(gpgId);
|
||||
}
|
||||
|
||||
void FriendList::createDisplayMenu()
|
||||
|
@ -63,8 +63,8 @@ public:
|
||||
// Add a tool button to the tool area
|
||||
void addToolButton(QToolButton *toolButton);
|
||||
void processSettings(bool load);
|
||||
void addGroupToExpand(const std::string &groupId);
|
||||
bool getExpandedGroups(std::set<std::string> &groups) const;
|
||||
void addGroupToExpand(const RsNodeGroupId &groupId);
|
||||
bool getExpandedGroups(std::set<RsNodeGroupId> &groups) const;
|
||||
void addPeerToExpand(const std::string &gpgId);
|
||||
bool getExpandedPeers(std::set<std::string> &peers) const;
|
||||
|
||||
@ -119,8 +119,9 @@ private:
|
||||
QString mFilterText;
|
||||
|
||||
bool groupsHasChanged;
|
||||
std::set<std::string> *openGroups;
|
||||
std::set<std::string> *openPeers;
|
||||
std::set<RsNodeGroupId> openGroups;
|
||||
#warning this would needs an ID, not a std::string.
|
||||
std::set<std::string> openPeers;
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mTextColorGroup;
|
||||
@ -129,8 +130,8 @@ private:
|
||||
QTreeWidgetItem *getCurrentPeer() const;
|
||||
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds);
|
||||
|
||||
bool getOrCreateGroup(const std::string &name, const uint &flag, std::string &id);
|
||||
bool getGroupIdByName(const std::string &name, std::string &id);
|
||||
bool getOrCreateGroup(const std::string &name, const uint &flag, RsNodeGroupId &id);
|
||||
bool getGroupIdByName(const std::string &name, RsNodeGroupId &id);
|
||||
|
||||
bool importExportFriendlistFileDialog(QString &fileName, bool import);
|
||||
bool exportFriendlist(QString &fileName);
|
||||
|
@ -271,9 +271,9 @@ void FriendSelectionWidget::secured_fillList()
|
||||
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
|
||||
}
|
||||
|
||||
std::set<std::string> groupIdsSelected;
|
||||
std::set<RsNodeGroupId> groupIdsSelected;
|
||||
if (mShowTypes & SHOW_GROUP) {
|
||||
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
|
||||
selectedIds<RsNodeGroupId,IDTYPE_GROUP>(groupIdsSelected,true);
|
||||
}
|
||||
|
||||
std::set<RsPgpId> gpgIdsSelected;
|
||||
@ -347,7 +347,7 @@ void FriendSelectionWidget::secured_fillList()
|
||||
groupItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
groupItem->setIcon(COLUMN_NAME, QIcon(IMAGE_GROUP16));
|
||||
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
|
||||
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
|
||||
|
||||
groupItem->setExpanded(true);
|
||||
|
||||
@ -363,7 +363,7 @@ void FriendSelectionWidget::secured_fillList()
|
||||
groupItem->setCheckState(0, Qt::Unchecked);
|
||||
}
|
||||
|
||||
emit itemAdded(IDTYPE_GROUP, QString::fromStdString(groupInfo->id), groupItem);
|
||||
emit itemAdded(IDTYPE_GROUP, QString::fromStdString(groupInfo->id.toStdString()), groupItem);
|
||||
|
||||
if (std::find(groupIdsSelected.begin(), groupIdsSelected.end(), groupInfo->id) != groupIdsSelected.end()) {
|
||||
setSelected(mListModus, groupItem, true);
|
||||
|
@ -20,7 +20,7 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
|
||||
|
||||
void GroupSelectionBox::fillGroups()
|
||||
{
|
||||
std::list<std::string> selectedIds;
|
||||
std::list<RsNodeGroupId> selectedIds;
|
||||
selectedGroupIds(selectedIds);
|
||||
|
||||
clear();
|
||||
@ -30,7 +30,7 @@ void GroupSelectionBox::fillGroups()
|
||||
|
||||
for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
|
||||
QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
|
||||
item->setData(ROLE_ID, QString::fromStdString(it->id));
|
||||
item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
|
||||
item->setBackgroundColor(QColor(183,236,181));
|
||||
addItem(item);
|
||||
}
|
||||
@ -38,27 +38,27 @@ void GroupSelectionBox::fillGroups()
|
||||
setSelectedGroupIds(selectedIds);
|
||||
}
|
||||
|
||||
void GroupSelectionBox::selectedGroupIds(std::list<std::string> &groupIds) const
|
||||
void GroupSelectionBox::selectedGroupIds(std::list<RsNodeGroupId> &groupIds) const
|
||||
{
|
||||
int itemCount = count();
|
||||
|
||||
for (int i = 0; i < itemCount; ++i) {
|
||||
QListWidgetItem *listItem = item(i);
|
||||
if (listItem->checkState() == Qt::Checked) {
|
||||
groupIds.push_back(item(i)->data(ROLE_ID).toString().toStdString());
|
||||
groupIds.push_back(RsNodeGroupId(item(i)->data(ROLE_ID).toString().toStdString()));
|
||||
std::cerr << "Adding selected item " << groupIds.back() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GroupSelectionBox::setSelectedGroupIds(const std::list<std::string>& groupIds)
|
||||
void GroupSelectionBox::setSelectedGroupIds(const std::list<RsNodeGroupId>& groupIds)
|
||||
{
|
||||
int itemCount = count();
|
||||
|
||||
for (int i = 0; i < itemCount; ++i) {
|
||||
QListWidgetItem *listItem = item(i);
|
||||
|
||||
if (std::find(groupIds.begin(), groupIds.end(), listItem->data(ROLE_ID).toString().toStdString()) != groupIds.end()) {
|
||||
if (std::find(groupIds.begin(), groupIds.end(), RsNodeGroupId(listItem->data(ROLE_ID).toString().toStdString())) != groupIds.end()) {
|
||||
listItem->setCheckState(Qt::Checked);
|
||||
} else {
|
||||
listItem->setCheckState(Qt::Unchecked);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QListWidget>
|
||||
#include <retroshare/rsids.h>
|
||||
|
||||
class GroupSelectionBox: public QListWidget
|
||||
{
|
||||
@ -7,10 +8,10 @@ class GroupSelectionBox: public QListWidget
|
||||
public:
|
||||
GroupSelectionBox(QWidget *parent);
|
||||
|
||||
void selectedGroupIds(std::list<std::string> &groupIds) const;
|
||||
void selectedGroupIds(std::list<RsNodeGroupId> &groupIds) const;
|
||||
void selectedGroupNames(QList<QString> &groupNames) const;
|
||||
|
||||
void setSelectedGroupIds(const std::list<std::string> &groupIds);
|
||||
void setSelectedGroupIds(const std::list<RsNodeGroupId> &groupIds);
|
||||
|
||||
private slots:
|
||||
void fillGroups();
|
||||
|
@ -297,7 +297,7 @@ static void fillGroups(ConnectFriendWizard *wizard, QComboBox *comboBox, const Q
|
||||
GroupDefs::sortByName(groupInfoList);
|
||||
comboBox->addItem("", ""); // empty value
|
||||
for (std::list<RsGroupInfo>::iterator groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
|
||||
comboBox->addItem(GroupDefs::name(*groupIt), QString::fromStdString(groupIt->id));
|
||||
comboBox->addItem(GroupDefs::name(*groupIt), QString::fromStdString(groupIt->id.toStdString()));
|
||||
}
|
||||
|
||||
if (groupId.isEmpty() == false) {
|
||||
@ -853,7 +853,7 @@ void ConnectFriendWizard::accept()
|
||||
}
|
||||
|
||||
if (!groupId.isEmpty())
|
||||
rsPeers->assignPeerToGroup(groupId.toStdString(), peerDetails.gpg_id, true);
|
||||
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
|
||||
}
|
||||
|
||||
if ((accept_connection) && (!peerDetails.id.isNull()))
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
/** Default constructor */
|
||||
CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
|
||||
CreateGroup::CreateGroup(const RsNodeGroupId &groupId, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
@ -51,7 +51,7 @@ CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
|
||||
ui.friendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GPG);
|
||||
ui.friendList->start();
|
||||
|
||||
if (mGroupId.empty() == false) {
|
||||
if (!mGroupId.isNull()) {
|
||||
/* edit exisiting group */
|
||||
RsGroupInfo groupInfo;
|
||||
if (rsPeers->getGroupInfo(mGroupId, groupInfo)) {
|
||||
@ -83,7 +83,7 @@ CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
|
||||
|
||||
std::list<RsGroupInfo>::iterator groupIt;
|
||||
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
|
||||
if (mGroupId.empty() || groupIt->id != mGroupId) {
|
||||
if (mGroupId.isNull() || groupIt->id != mGroupId) {
|
||||
mUsedGroupNames.append(GroupDefs::name(*groupIt));
|
||||
}
|
||||
}
|
||||
@ -114,14 +114,19 @@ void CreateGroup::changeGroup()
|
||||
{
|
||||
RsGroupInfo groupInfo;
|
||||
|
||||
if (mGroupId.empty()) {
|
||||
if (mGroupId.isNull())
|
||||
{
|
||||
// add new group
|
||||
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
|
||||
if (!rsPeers->addGroup(groupInfo)) {
|
||||
|
||||
if (!rsPeers->addGroup(groupInfo))
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (rsPeers->getGroupInfo(mGroupId, groupInfo) == true) {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rsPeers->getGroupInfo(mGroupId, groupInfo))
|
||||
{
|
||||
if (!mIsStandard) {
|
||||
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
|
||||
if (!rsPeers->editGroup(mGroupId, groupInfo)) {
|
||||
|
@ -30,7 +30,7 @@ class CreateGroup : public QDialog
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
CreateGroup(const std::string &groupId, QWidget *parent = 0);
|
||||
CreateGroup(const RsNodeGroupId &groupId, QWidget *parent = 0);
|
||||
/** Default destructor */
|
||||
~CreateGroup();
|
||||
|
||||
@ -39,7 +39,7 @@ private slots:
|
||||
void groupNameChanged(QString);
|
||||
|
||||
private:
|
||||
std::string mGroupId;
|
||||
RsNodeGroupId mGroupId;
|
||||
QStringList mUsedGroupNames;
|
||||
bool mIsStandard;
|
||||
|
||||
|
@ -887,7 +887,7 @@ void MessageComposer::calculateTitle()
|
||||
setWindowTitle(tr("Compose") + ": " + misc::removeNewLine(ui.titleEdit->text()));
|
||||
}
|
||||
|
||||
static void calculateGroupsOfSslIds(const std::list<RsGroupInfo> &existingGroupInfos, std::list<RsPeerId> &checkSslIds, std::list<std::string> &checkGroupIds)
|
||||
static void calculateGroupsOfSslIds(const std::list<RsGroupInfo> &existingGroupInfos, std::list<RsPeerId> &checkSslIds, std::list<RsNodeGroupId> &checkGroupIds)
|
||||
{
|
||||
checkGroupIds.clear();
|
||||
|
||||
@ -1342,7 +1342,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
||||
{
|
||||
case PEER_TYPE_GROUP: {
|
||||
RsGroupInfo groupInfo;
|
||||
if (rsPeers->getGroupInfo(id, groupInfo) == false) {
|
||||
if (rsPeers->getGroupInfo(RsNodeGroupId(id), groupInfo) == false) {
|
||||
// group not found
|
||||
continue;
|
||||
}
|
||||
@ -1587,7 +1587,7 @@ void MessageComposer::setRecipientToRow(int row, enumType type, destinationType
|
||||
icon = QIcon(IMAGE_GROUP16);
|
||||
|
||||
RsGroupInfo groupInfo;
|
||||
if (rsPeers->getGroupInfo(id, groupInfo)) {
|
||||
if (rsPeers->getGroupInfo(RsNodeGroupId(id), groupInfo)) {
|
||||
name = GroupDefs::name(groupInfo);
|
||||
} else {
|
||||
name = tr("Unknown");
|
||||
@ -1771,7 +1771,7 @@ void MessageComposer::editingRecipientFinished()
|
||||
QString groupName = GroupDefs::name(*groupIt);
|
||||
if (text.compare(groupName, Qt::CaseSensitive) == 0) {
|
||||
// found it
|
||||
setRecipientToRow(row, type, PEER_TYPE_GROUP, groupIt->id);
|
||||
setRecipientToRow(row, type, PEER_TYPE_GROUP, groupIt->id.toStdString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user