implement dummy friend for a gpg key, improve PersDialog ui

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2018 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-13 21:25:18 +00:00
parent 9976b80566
commit e50dc4e3b9
9 changed files with 212 additions and 83 deletions

View file

@ -1355,8 +1355,15 @@ bool p3ConnectMgr::getOwnNetStatus(peerConnectState &state)
bool p3ConnectMgr::isFriend(std::string id)
{
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
return (mFriendList.end() != mFriendList.find(id));
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::isFriend(" << id << ") called" << std::endl;
#endif
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
bool ret = (mFriendList.end() != mFriendList.find(id));
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::isFriend(" << id << ") returning : " << ret << std::endl;
#endif
return ret;
}
bool p3ConnectMgr::isOnline(std::string id)
@ -1990,7 +1997,7 @@ void p3ConnectMgr::peerConnectRequest(std::string id, struct sockaddr_in radd
bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
{
/* so three possibilities
/* so four possibilities
* (1) already exists as friend -> do nothing.
* (2) is in others list -> move over.
* (3) is non-existant -> create new one.
@ -2000,6 +2007,12 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
std::cerr << "p3ConnectMgr::addFriend() " << id << "; gpg_id : " << gpg_id << std::endl;
#endif
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::addFriend() removing dummy friend" << std::endl;
#endif
//remove any dummy friend because we just add a real ssl friend
removeFriend("dummy"+ gpg_id);
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
@ -2101,7 +2114,8 @@ bool p3ConnectMgr::removeFriend(std::string id)
{
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() " << id << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() for id : " << id << std::endl;
std::cerr << "p3ConnectMgr::removeFriend() mFriendList.size() : " << mFriendList.size() << std::endl;
#endif
netAssistFriend(id, false);
@ -2114,7 +2128,10 @@ bool p3ConnectMgr::removeFriend(std::string id)
if (mFriendList.end() != (it = mFriendList.find(id)))
{
peerConnectState peer = it->second;
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() friend found in the list." << id << std::endl;
#endif
peerConnectState peer = it->second;
mFriendList.erase(it);
@ -2123,13 +2140,16 @@ bool p3ConnectMgr::removeFriend(std::string id)
peer.state &= (~RS_PEER_S_ONLINE);
peer.actions = RS_PEER_MOVED;
peer.inConnAttempt = false;
mOthersList[id] = peer;
//mOthersList[id] = peer;
mStatusChanged = true;
success = true;
}
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::removeFriend() new mFriendList.size() : " << mFriendList.size() << std::endl;
#endif
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
return success;
}