diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index 8e759fadc..ec7ccff95 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -157,7 +157,7 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci) //name = cli->nick; //popupChatFlag = RS_POPUP_CHATLOBBY; - RsServer::notify()->AddPopupMessage(RS_POPUP_CHATLOBBY, cli->signature.keyId.toStdString(), cli->nick, cli->message); /* notify private chat message */ + RsServer::notify()->AddPopupMessage(RS_POPUP_CHATLOBBY, virtual_peer_id.toStdString(), cli->signature.keyId.toStdString(), cli->message); /* notify private chat message */ return true ; } diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 9e32b09bf..a6b8b5457 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -29,6 +29,7 @@ #include "notifyqt.h" #include #include +#include #include #include "RsAutoUpdatePage.h" @@ -862,28 +863,23 @@ void NotifyQt::UpdateGUI() case RS_POPUP_CHATLOBBY: if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster) { - if(RsPeerId::SIZE_IN_BYTES < sizeof(ChatLobbyId)) - { - std::cerr << "NotifyQt::UpdateGUI() Error: ChatLobbyId does not fit into a RsPeerId, this should not happen!" << std::endl; - break; - } - RsPeerId vpid(id); // create virtual peer id - ChatLobbyId lobby_id; - // copy first bytes of virtual peer id, to make a chat lobby id - memcpy(&lobby_id, vpid.toByteArray(), sizeof(ChatLobbyId)); + ChatLobbyId lobby_id; + if(!rsMsgs->isLobbyId(RsPeerId(id), lobby_id)) + break; - ChatDialog *chatDialog = ChatDialog::getChat(ChatId(lobby_id)); - ChatWidget *chatWidget; + ChatDialog *chatDialog = ChatDialog::getChat(ChatId(lobby_id)); + ChatWidget *chatWidget; if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) { // do not show when active break; } ChatLobbyDialog *chatLobbyDialog = dynamic_cast(chatDialog); - if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(RsGxsId(title))) + RsGxsId sender(title); + if (!chatLobbyDialog || chatLobbyDialog->isParticipantMuted(sender)) break; // participant is muted - toaster = new ToasterItem(new ChatLobbyToaster(lobby_id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str()))); + toaster = new ToasterItem(new ChatLobbyToaster(lobby_id, sender, QString::fromUtf8(msg.c_str()))); } break; case RS_POPUP_CONNECT_ATTEMPT: @@ -1002,8 +998,13 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit toaster = new ToasterItem(new GroupChatToaster(id, message)); break; case RS_POPUP_CHATLOBBY: - toaster = new ToasterItem(new ChatLobbyToaster(0, title, message)); - break; + { + std::list gxsid; + if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){ + toaster = new ToasterItem(new ChatLobbyToaster(0, gxsid.front(), message)); + } + break; + } case RS_POPUP_CONNECT_ATTEMPT: toaster = new ToasterItem(new FriendRequestToaster(pgpid, title, id)); break; diff --git a/retroshare-gui/src/gui/toaster/ChatLobbyToaster.cpp b/retroshare-gui/src/gui/toaster/ChatLobbyToaster.cpp index 325d56f30..882004975 100644 --- a/retroshare-gui/src/gui/toaster/ChatLobbyToaster.cpp +++ b/retroshare-gui/src/gui/toaster/ChatLobbyToaster.cpp @@ -22,10 +22,11 @@ #include "ChatLobbyToaster.h" #include "gui/chat/ChatDialog.h" #include "util/HandleRichText.h" +#include #include -ChatLobbyToaster::ChatLobbyToaster(const ChatLobbyId &lobby_id, const QString &name, const QString &message): +ChatLobbyToaster::ChatLobbyToaster(const ChatLobbyId &lobby_id, const RsGxsId &sender_id, const QString &message): QWidget(NULL), mLobbyId(lobby_id) { /* Invoke the Qt Designer generated object setup routine */ @@ -39,7 +40,14 @@ ChatLobbyToaster::ChatLobbyToaster(const ChatLobbyId &lobby_id, const QString &n ui.avatarWidget->setFrameType(AvatarWidget::NORMAL_FRAME); ui.avatarWidget->setDefaultAvatar(":images/chat_64.png"); - QString lobbyName = RsHtml::plainText(name); + /* Get sender info */ + RsIdentityDetails idd; + if(!rsIdentity->getIdDetails(sender_id, idd)) + return; + + ui.avatarWidget->setId(ChatId(sender_id)); + + QString lobbyName = RsHtml::plainText(idd.mNickname); ChatLobbyInfo clinfo ; if(rsMsgs->getChatLobbyInfo(mLobbyId,clinfo)) diff --git a/retroshare-gui/src/gui/toaster/ChatLobbyToaster.h b/retroshare-gui/src/gui/toaster/ChatLobbyToaster.h index bc7c3d262..a5c18d8f2 100644 --- a/retroshare-gui/src/gui/toaster/ChatLobbyToaster.h +++ b/retroshare-gui/src/gui/toaster/ChatLobbyToaster.h @@ -36,7 +36,7 @@ class ChatLobbyToaster : public QWidget Q_OBJECT public: - ChatLobbyToaster(const ChatLobbyId &lobby_id, const QString &name, const QString &message); + ChatLobbyToaster(const ChatLobbyId &lobby_id, const RsGxsId &sender_id, const QString &message); private slots: void chatButtonSlot();