use ChatId instead of virtual peer id for chat lobby popup. Removed a now unused method from rsmsgs interface and DistributedChatService.

This commit is contained in:
electron128 2016-01-10 13:29:40 +01:00
parent c3d422ac86
commit 67e1495d9a
6 changed files with 4 additions and 28 deletions

View File

@ -202,7 +202,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
//name = cli->nick;
//popupChatFlag = RS_POPUP_CHATLOBBY;
RsServer::notify()->AddPopupMessage(RS_POPUP_CHATLOBBY, virtual_peer_id.toStdString(), cli->signature.keyId.toStdString(), cli->message); /* notify private chat message */
RsServer::notify()->AddPopupMessage(RS_POPUP_CHATLOBBY, ChatId(cli->lobby_id).toStdString(), cli->signature.keyId.toStdString(), cli->message); /* notify private chat message */
return true ;
}
@ -339,21 +339,6 @@ void DistributedChatService::locked_printDebugInfo() const
std::cerr << " \"" << std::hex << it->first << "\" flags = " << it->second << std::dec << std::endl;
}
bool DistributedChatService::isLobbyId(const RsPeerId& virtual_peer_id,ChatLobbyId& lobby_id)
{
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
std::map<ChatLobbyVirtualPeerId,ChatLobbyId>::const_iterator it(_lobby_ids.find(virtual_peer_id)) ;
if(it != _lobby_ids.end())
{
lobby_id = it->second ;
return true ;
}
lobby_id = 0;
return false ;
}
bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObject *obj,const RsPeerId& peer_id,uint32_t lobby_count)
{
static std::map<std::string, std::list<time_t> > message_counts ;

View File

@ -60,7 +60,6 @@ class DistributedChatService
// Interface part to communicate with
//
bool getVirtualPeerId(const ChatLobbyId& lobby_id, RsPeerId& virtual_peer_id) ;
bool isLobbyId(const RsPeerId& virtual_peer_id, ChatLobbyId& lobby_id) ;
void getChatLobbyList(std::list<ChatLobbyId>& clids) ;
bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& clinfo) ;
bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) ;

View File

@ -464,7 +464,6 @@ virtual void getOwnAvatarData(unsigned char *& data,int& size) = 0 ;
/****************************************/
virtual bool joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& own_id) = 0 ;
virtual bool isLobbyId(const RsPeerId& virtual_peer_id,ChatLobbyId& lobby_id) = 0;
virtual bool getVirtualPeerId(const ChatLobbyId& lobby_id,RsPeerId& vpid) = 0;
virtual void getChatLobbyList(std::list<ChatLobbyId>& cl_list) = 0;
virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) = 0 ;

View File

@ -448,10 +448,6 @@ bool p3Msgs::getVirtualPeerId(const ChatLobbyId& id,RsPeerId& peer_id)
{
return mChatSrv->getVirtualPeerId(id,peer_id) ;
}
bool p3Msgs::isLobbyId(const RsPeerId& peer_id,ChatLobbyId& id)
{
return mChatSrv->isLobbyId(peer_id,id) ;
}
bool p3Msgs::getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& linfo)
{

View File

@ -139,7 +139,6 @@ class p3Msgs: public RsMsgs
virtual bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &own_id) ;
virtual void getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& public_lobbies) ;
virtual bool getVirtualPeerId(const ChatLobbyId& id,RsPeerId& vpid) ;
virtual bool isLobbyId(const RsPeerId& virtual_peer_id,ChatLobbyId& lobby_id) ;
virtual void getChatLobbyList(std::list<ChatLobbyId>& cl_list) ;
virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) ;
virtual void invitePeerToLobby(const ChatLobbyId&, const RsPeerId&) ;

View File

@ -863,11 +863,9 @@ void NotifyQt::UpdateGUI()
case RS_POPUP_CHATLOBBY:
if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster)
{
ChatLobbyId lobby_id;
if(!rsMsgs->isLobbyId(RsPeerId(id), lobby_id))
break;
ChatId chat_id(id);
ChatDialog *chatDialog = ChatDialog::getChat(ChatId(lobby_id));
ChatDialog *chatDialog = ChatDialog::getChat(chat_id);
ChatWidget *chatWidget;
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
// do not show when active
@ -879,7 +877,7 @@ void NotifyQt::UpdateGUI()
if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(sender))
break; // participant is muted
toaster = new ToasterItem(new ChatLobbyToaster(lobby_id, sender, QString::fromUtf8(msg.c_str())));
toaster = new ToasterItem(new ChatLobbyToaster(chat_id.toLobbyId(), sender, QString::fromUtf8(msg.c_str())));
}
break;
case RS_POPUP_CONNECT_ATTEMPT: