mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Count the own gpg id as friend, when another location exists.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3896 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
207dddf4d8
commit
38203704f0
@ -1630,28 +1630,38 @@ bool p3ConnectMgr::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOn
|
||||
if (pnFriendCount) *pnFriendCount = 0;
|
||||
if (pnOnlineCount) *pnOnlineCount = 0;
|
||||
|
||||
if (pnFriendCount || pnOnlineCount) {
|
||||
std::list<std::string> gpgIds;
|
||||
if (AuthGPG::getAuthGPG()->getGPGAcceptedList(gpgIds) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pnFriendCount) *pnFriendCount = gpgIds.size();
|
||||
/* add own id */
|
||||
gpgIds.push_back(AuthGPG::getAuthGPG()->getGPGOwnId());
|
||||
|
||||
std::list<std::string> gpgOnlineIds = gpgIds;
|
||||
|
||||
if (pnOnlineCount) {
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::list<std::string>::iterator gpgIt;
|
||||
|
||||
/* check ssl id's */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
for (it = mFriendList.begin(); it != mFriendList.end(); it++) {
|
||||
if (it->second.state & RS_PEER_S_CONNECTED) {
|
||||
std::list<std::string>::iterator gpgIt = std::find(gpgIds.begin(), gpgIds.end(), it->second.gpg_id);
|
||||
if (pnFriendCount && gpgIds.size()) {
|
||||
gpgIt = std::find(gpgIds.begin(), gpgIds.end(), it->second.gpg_id);
|
||||
if (gpgIt != gpgIds.end()) {
|
||||
(*pnOnlineCount)++;
|
||||
(*pnFriendCount)++;
|
||||
gpgIds.erase(gpgIt);
|
||||
}
|
||||
}
|
||||
|
||||
if (gpgIds.empty()) {
|
||||
/* no more gpg id's to check */
|
||||
break;
|
||||
if (pnOnlineCount && gpgOnlineIds.size()) {
|
||||
if (it->second.state & RS_PEER_S_CONNECTED) {
|
||||
gpgIt = std::find(gpgOnlineIds.begin(), gpgOnlineIds.end(), it->second.gpg_id);
|
||||
if (gpgIt != gpgOnlineIds.end()) {
|
||||
(*pnOnlineCount)++;
|
||||
gpgOnlineIds.erase(gpgIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user