mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-23 14:41:04 -04:00
added check for group/friends consistency at loadign time
This commit is contained in:
parent
5c08dcb0de
commit
6ebea19087
1 changed files with 21 additions and 5 deletions
|
@ -1066,8 +1066,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::addSslOnlyFriend(
|
bool p3PeerMgrIMPL::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
||||||
const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
|
||||||
{
|
{
|
||||||
constexpr auto fname = __PRETTY_FUNCTION__;
|
constexpr auto fname = __PRETTY_FUNCTION__;
|
||||||
const auto failure = [&](const std::string& err)
|
const auto failure = [&](const std::string& err)
|
||||||
|
@ -2435,7 +2434,6 @@ void p3PeerMgrIMPL::saveDone()
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||||
{
|
{
|
||||||
|
|
||||||
// DEFAULTS.
|
// DEFAULTS.
|
||||||
bool useExtAddrFinder = true;
|
bool useExtAddrFinder = true;
|
||||||
std::string proxyIpAddressTor = kConfigDefaultProxyServerIpAddr;
|
std::string proxyIpAddressTor = kConfigDefaultProxyServerIpAddr;
|
||||||
|
@ -2684,13 +2682,31 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||||
|
|
||||||
groupList[info.id] = info;
|
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 we are hidden - don't want ExtAddrFinder - ever!
|
||||||
if (isHidden())
|
if (isHidden())
|
||||||
{
|
|
||||||
useExtAddrFinder = false;
|
useExtAddrFinder = false;
|
||||||
}
|
|
||||||
|
|
||||||
mNetMgr->setIPServersEnabled(useExtAddrFinder);
|
mNetMgr->setIPServersEnabled(useExtAddrFinder);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue