From 67e1495d9a78ac259649014355cd127a2febeaaf Mon Sep 17 00:00:00 2001 From: electron128 Date: Sun, 10 Jan 2016 13:29:40 +0100 Subject: [PATCH] use ChatId instead of virtual peer id for chat lobby popup. Removed a now unused method from rsmsgs interface and DistributedChatService. --- libretroshare/src/chat/distributedchat.cc | 17 +---------------- libretroshare/src/chat/distributedchat.h | 1 - libretroshare/src/retroshare/rsmsgs.h | 1 - libretroshare/src/rsserver/p3msgs.cc | 4 ---- libretroshare/src/rsserver/p3msgs.h | 1 - retroshare-gui/src/gui/notifyqt.cpp | 8 +++----- 6 files changed, 4 insertions(+), 28 deletions(-) diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index bced27d30..7ad8019ae 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -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::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 > message_counts ; diff --git a/libretroshare/src/chat/distributedchat.h b/libretroshare/src/chat/distributedchat.h index e77a3d802..2cb397740 100644 --- a/libretroshare/src/chat/distributedchat.h +++ b/libretroshare/src/chat/distributedchat.h @@ -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& clids) ; bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& clinfo) ; bool acceptLobbyInvite(const ChatLobbyId& id,const RsGxsId& identity) ; diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h index 3d18a11ac..a8524759b 100644 --- a/libretroshare/src/retroshare/rsmsgs.h +++ b/libretroshare/src/retroshare/rsmsgs.h @@ -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& cl_list) = 0; virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) = 0 ; diff --git a/libretroshare/src/rsserver/p3msgs.cc b/libretroshare/src/rsserver/p3msgs.cc index 64c5b0179..50d842f83 100644 --- a/libretroshare/src/rsserver/p3msgs.cc +++ b/libretroshare/src/rsserver/p3msgs.cc @@ -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) { diff --git a/libretroshare/src/rsserver/p3msgs.h b/libretroshare/src/rsserver/p3msgs.h index ecef61b30..4e5efc5b6 100644 --- a/libretroshare/src/rsserver/p3msgs.h +++ b/libretroshare/src/rsserver/p3msgs.h @@ -139,7 +139,6 @@ class p3Msgs: public RsMsgs virtual bool joinVisibleChatLobby(const ChatLobbyId& id, const RsGxsId &own_id) ; virtual void getListOfNearbyChatLobbies(std::vector& 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& cl_list) ; virtual bool getChatLobbyInfo(const ChatLobbyId& id,ChatLobbyInfo& info) ; virtual void invitePeerToLobby(const ChatLobbyId&, const RsPeerId&) ; diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index a6b8b5457..7c19da271 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -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: