summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp10
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp1
2 files changed, 10 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index b0aef95..da96603 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -628,7 +628,15 @@ void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) {
}
//if not a mucroom
- getChatControllerOrCreate(jid)->handleIncomingMessage(event);
+ if (!event->isReadable() && !isInvite && !isMediatedInvite) {
+ /* Only route such messages if a window exists, don't open new windows for them.*/
+ ChatController* controller = getChatControllerIfExists(jid);
+ if (controller) {
+ controller->handleIncomingMessage(event);
+ }
+ } else {
+ getChatControllerOrCreate(jid)->handleIncomingMessage(event);
+ }
}
void ChatsManager::handleMUCSelectedAfterSearch(const JID& muc) {
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index bbfb22f..3d2db7d 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -433,6 +433,7 @@ private:
boost::shared_ptr<Message> message = boost::make_shared<Message>();
message->setFrom(from);
message->setID(id);
+ message->setBody("This will cause the window to open");
message->addPayload(boost::make_shared<DeliveryReceiptRequest>());
return message;
}