Display old and new nickname to Peers during nickname change in ChatLobby.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5151 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
notdefine 2012-05-06 22:57:08 +00:00
parent 22bfcb62bc
commit d5bdae7bd9
6 changed files with 10 additions and 9 deletions

View File

@ -265,7 +265,7 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
virtual bool joinPublicChatLobby(const ChatLobbyId& lobby_id) = 0 ;
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id) = 0 ;
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick) = 0 ;
virtual bool isLobbyId(const std::string& virtual_peer_id,ChatLobbyId& lobby_id) = 0;

View File

@ -308,9 +308,9 @@ bool p3Msgs::joinPublicChatLobby(const ChatLobbyId& lobby_id)
return mChatSrv->joinPublicChatLobby(lobby_id) ;
}
bool p3Msgs::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id)
bool p3Msgs::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick)
{
return mChatSrv->sendLobbyStatusPeerChangedNickname(lobby_id) ;
return mChatSrv->sendLobbyStatusPeerChangedNickname(lobby_id, newnick) ;
}

View File

@ -171,7 +171,7 @@ class p3Msgs: public RsMsgs
virtual bool joinPublicChatLobby(const ChatLobbyId& id) ;
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& id) ;
virtual bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& id, const std::string& newnick) ;
virtual void getListOfNearbyChatLobbies(std::vector<PublicChatLobbyRecord>& public_lobbies) ;
virtual bool getVirtualPeerId(const ChatLobbyId& id,std::string& vpid) ;

View File

@ -1775,12 +1775,12 @@ void p3ChatService::sendLobbyStatusString(const ChatLobbyId& lobby_id,const std:
*
* as example for updating their ChatLobby Blocklist for muted peers
* */
bool p3ChatService::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id)
bool p3ChatService::sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick)
{
std::string nick ;
getNickNameForChatLobby(lobby_id,nick) ;
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME,nick) ;
sendLobbyStatusItem(lobby_id,RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME, newnick) ;
return true;
}

View File

@ -76,7 +76,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
*/
bool sendPrivateChat(const std::string &id, const std::wstring &msg);
bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id) ;
bool sendLobbyStatusPeerChangedNickname(const ChatLobbyId& lobby_id, const std::string& newnick) ;
/*!
* can be used to send 'immediate' status msgs, these status updates are meant for immediate use by peer (not saved by rs)

View File

@ -140,7 +140,6 @@ void ChatLobbyDialog::setNickname(const QString &nickname)
// std::string oldNickName;
// rsMsgs->getNickNameForChatLobby(lobbyId, oldNickName);
rsMsgs->sendLobbyStatusPeerChangedNickname(lobbyId);
rsMsgs->setNickNameForChatLobby(lobbyId, nickname.toUtf8().constData());
ui.chatWidget->setName(nickname);
@ -161,6 +160,8 @@ void ChatLobbyDialog::changeNickname()
dialog.setTextValue(QString::fromUtf8(nickName.c_str()));
if (dialog.exec() == QDialog::Accepted) {
// Informate other peers of change the Nickname, to update their mute list
rsMsgs->sendLobbyStatusPeerChangedNickname(lobbyId, dialog.textValue().toUtf8().constData());
setNickname(dialog.textValue());
}
}
@ -303,7 +304,7 @@ void ChatLobbyDialog::displayLobbyEvent(int event_type, const QString& nickname,
ui.chatWidget->updateStatusString(nickname + " %1", str);
break;
case RS_CHAT_LOBBY_EVENT_PEER_CHANGE_NICKNAME:
ui.chatWidget->addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 changed his name to:").arg(str), ChatWidget::TYPE_SYSTEM);
ui.chatWidget->addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 changed his name to: %2").arg(nickname, str), ChatWidget::TYPE_SYSTEM);
break;
case RS_CHAT_LOBBY_EVENT_KEEP_ALIVE:
//std::cerr << "Received keep alive packet from " << nickname.toStdString() << " in lobby " << getPeerId() << std::endl;