fixed bug in previous commit for chat lobbies

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8386 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-06-06 14:01:08 +00:00
parent ea7a5a5929
commit 377eb50c6e
2 changed files with 23 additions and 25 deletions

View File

@ -1622,14 +1622,14 @@ bool DistributedChatService::getIdentityForChatLobby(const ChatLobbyId& lobby_id
bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& nick)
{
if (nick.isNull())
{
{
std::cerr << "(EE) Ignore empty nickname for chat lobby " << nick << std::endl;
return false;
}
return false;
}
// first check for change and send status peer changed nick name
bool changed = false;
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it;
// first check for change and send status peer changed nick name
bool changed = false;
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it;
{
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
@ -1646,36 +1646,36 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id
}
if (!it->second.gxs_id.isNull() && it->second.gxs_id != nick)
changed = true;
}
if (changed)
{
// Inform other peers of change the Nickname
{
RsIdentityDetails det1,det2 ;
// Only send a nickname change event if the two Identities are not anonymous
if(rsIdentity->getIdDetails(nick,det1) && rsIdentity->getIdDetails(it->second.gxs_id,det2) && det1.mPgpLinked && det2.mPgpLinked)
changed = true;
sendLobbyStatusPeerChangedNickname(lobby_id, nick.toStdString()) ;
}
}
if (changed)
{
// Inform other peers of change the Nickname
sendLobbyStatusPeerChangedNickname(lobby_id, nick.toStdString()) ;
// set new nick name
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
// set new nick name
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
it = _chat_lobbys.find(lobby_id) ;
it = _chat_lobbys.find(lobby_id) ;
if(it == _chat_lobbys.end())
{
std::cerr << " (EE) lobby does not exist!!" << std::endl;
return false;
}
if(it == _chat_lobbys.end())
{
std::cerr << " (EE) lobby does not exist!!" << std::endl;
return false;
}
it->second.gxs_id = nick ;
}
}
return true ;
return true ;
}
void DistributedChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe)

View File

@ -372,8 +372,6 @@ private:
struct sockaddr_storage mProxyServerAddress;
uint32_t mProxyServerStatus ;
//std::map<RsPeerId,std::pair<sockaddr_storage,time_t> > mReportedConnectionIps ;
};
#endif // MRK_PQI_PEER_MANAGER_HEADER