mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
added check for group/friends consistency at loadign time
This commit is contained in:
parent
5c08dcb0de
commit
6ebea19087
@ -1066,8 +1066,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
|
||||
}
|
||||
|
||||
|
||||
bool p3PeerMgrIMPL::addSslOnlyFriend(
|
||||
const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
||||
bool p3PeerMgrIMPL::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
||||
{
|
||||
constexpr auto fname = __PRETTY_FUNCTION__;
|
||||
const auto failure = [&](const std::string& err)
|
||||
@ -2435,7 +2434,6 @@ void p3PeerMgrIMPL::saveDone()
|
||||
|
||||
bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||
{
|
||||
|
||||
// DEFAULTS.
|
||||
bool useExtAddrFinder = true;
|
||||
std::string proxyIpAddressTor = kConfigDefaultProxyServerIpAddr;
|
||||
@ -2684,13 +2682,31 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||
|
||||
groupList[info.id] = info;
|
||||
}
|
||||
|
||||
// Also filter out profiles in groups that are not friends. Normally this shouldn't be needed, but it's a precaution
|
||||
|
||||
for(auto group_pair:groupList)
|
||||
{
|
||||
for(auto profileIdIt(group_pair.second.peerIds.begin());profileIdIt!=group_pair.second.peerIds.end();)
|
||||
if(AuthGPG::getAuthGPG()->isGPGAccepted(*profileIdIt) || *profileIdIt == AuthGPG::getAuthGPG()->getGPGOwnId())
|
||||
++profileIdIt;
|
||||
else
|
||||
{
|
||||
std::cerr << "(WW) filtering out profile " << profileIdIt->toStdString() << " from group " << group_pair.first.toStdString() << " because it is not a friend anymore" << std::endl;
|
||||
|
||||
auto tmp = profileIdIt;
|
||||
++tmp;
|
||||
group_pair.second.peerIds.erase(profileIdIt);
|
||||
profileIdIt=tmp;
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we are hidden - don't want ExtAddrFinder - ever!
|
||||
if (isHidden())
|
||||
{
|
||||
useExtAddrFinder = false;
|
||||
}
|
||||
|
||||
mNetMgr->setIPServersEnabled(useExtAddrFinder);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user