From 581217137292397d39d81ab074c8895887e4ccf5 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mon, 22 Oct 2012 17:20:47 +0200 Subject: [PATCH] Do not create conversation when the message contain nickname, because that means the conversation should be MUC, but user didn't connect to that room yet --- src/networkpluginserver.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/networkpluginserver.cpp b/src/networkpluginserver.cpp index 6849a023..ea809858 100644 --- a/src/networkpluginserver.cpp +++ b/src/networkpluginserver.cpp @@ -633,8 +633,16 @@ void NetworkPluginServer::handleConvMessagePayload(const std::string &data, bool msg->addPayload(boost::make_shared(timestamp)); } - // Create new Conversation if it does not exist + NetworkConversation *conv = (NetworkConversation *) user->getConversationManager()->getConversation(payload.buddyname()); + + // We can't create Conversation for payload with nickname, because this means the message is from room, + // but this user is not in any room, so it's OK to just reject this message + if (!conv && !payload.nickname().empty()) { + return; + } + + // Create new Conversation if it does not exist if (!conv) { conv = new NetworkConversation(user->getConversationManager(), payload.buddyname()); user->getConversationManager()->addConversation(conv);