mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Changed p3Peers::getPeerCount to count also gpg id's only.
Show count of friends in MainWindow, not the count of locations. Recompile of GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3653 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0e063f9a1b
commit
1207b5793b
@ -473,10 +473,6 @@ void p3ConnectMgr::addNetListener(pqiNetListener *listener)
|
||||
mNetListeners.push_back(listener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void p3ConnectMgr::netStatusReset_locked()
|
||||
{
|
||||
//std::cerr << "p3ConnectMgr::netStatusReset()" << std::endl;;
|
||||
@ -1598,8 +1594,11 @@ void p3ConnectMgr::getOthersList(std::list<std::string> &peers)
|
||||
#endif
|
||||
|
||||
|
||||
void p3ConnectMgr::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount)
|
||||
bool p3ConnectMgr::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount, bool ssl)
|
||||
{
|
||||
if (ssl) {
|
||||
/* count ssl id's */
|
||||
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
if (pnFriendCount) *pnFriendCount = mFriendList.size();
|
||||
@ -1613,6 +1612,42 @@ void p3ConnectMgr::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOn
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* count gpg id's */
|
||||
|
||||
if (pnFriendCount) *pnFriendCount = 0;
|
||||
if (pnOnlineCount) *pnOnlineCount = 0;
|
||||
|
||||
std::list<std::string> gpgIds;
|
||||
if (AuthGPG::getAuthGPG()->getGPGAcceptedList(gpgIds) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pnFriendCount) *pnFriendCount = gpgIds.size();
|
||||
|
||||
if (pnOnlineCount) {
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* 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 (gpgIt != gpgIds.end()) {
|
||||
(*pnOnlineCount)++;
|
||||
gpgIds.erase(gpgIt);
|
||||
|
||||
if (gpgIds.empty()) {
|
||||
/* no more gpg id's to check */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -2644,8 +2679,6 @@ bool p3ConnectMgr::addAddressIfUnique(std::list<peerConnectAddress> &addrList,
|
||||
* in the list
|
||||
*/
|
||||
|
||||
bool found = false;
|
||||
|
||||
std::list<peerConnectAddress>::iterator it;
|
||||
for(it = addrList.begin(); it != addrList.end(); it++)
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ bool getOthersNetStatus(std::string id, peerConnectState &state);
|
||||
void getOnlineList(std::list<std::string> &ssl_peers);
|
||||
void getFriendList(std::list<std::string> &ssl_peers);
|
||||
//void getOthersList(std::list<std::string> &peers); /deprecated
|
||||
void getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount);
|
||||
bool getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount, bool ssl);
|
||||
|
||||
|
||||
/**************** handle monitors *****************/
|
||||
|
@ -159,7 +159,7 @@ virtual std::string getOwnId() = 0;
|
||||
virtual bool getOnlineList(std::list<std::string> &ssl_ids) = 0;
|
||||
virtual bool getFriendList(std::list<std::string> &ssl_ids) = 0;
|
||||
//virtual bool getOthersList(std::list<std::string> &ssl_ids) = 0;
|
||||
virtual void getPeerCount (unsigned int *pnFriendCount, unsigned int *pnnOnlineCount) = 0;
|
||||
virtual bool getPeerCount (unsigned int *pnFriendCount, unsigned int *pnnOnlineCount, bool ssl) = 0;
|
||||
|
||||
virtual bool isOnline(std::string ssl_id) = 0;
|
||||
virtual bool isFriend(std::string ssl_id) = 0;
|
||||
|
@ -221,14 +221,14 @@ bool p3Peers::getFriendList(std::list<std::string> &ids)
|
||||
// return true;
|
||||
//}
|
||||
|
||||
void p3Peers::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount)
|
||||
bool p3Peers::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount, bool ssl)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::getPeerCount()" << std::endl;
|
||||
#endif
|
||||
|
||||
/* get from mConnectMgr */
|
||||
mConnMgr->getPeerCount(pnFriendCount, pnOnlineCount);
|
||||
return mConnMgr->getPeerCount(pnFriendCount, pnOnlineCount, ssl);
|
||||
}
|
||||
|
||||
bool p3Peers::isOnline(std::string id)
|
||||
|
@ -46,7 +46,7 @@ virtual std::string getOwnId();
|
||||
virtual bool getOnlineList(std::list<std::string> &ids);
|
||||
virtual bool getFriendList(std::list<std::string> &ids);
|
||||
//virtual bool getOthersList(std::list<std::string> &ids);
|
||||
virtual void getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount);
|
||||
virtual bool getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount, bool ssl);
|
||||
|
||||
virtual bool isOnline(std::string id);
|
||||
virtual bool isFriend(std::string id);
|
||||
|
@ -514,7 +514,7 @@ void MainWindow::updateStatus()
|
||||
|
||||
unsigned int nFriendCount = 0;
|
||||
unsigned int nOnlineCount = 0;
|
||||
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount);
|
||||
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount, false);
|
||||
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user