summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-04-28 11:50:36 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-28 11:50:36 (GMT)
commitf60d331a3e32eff632a9af3b7bd5fc1c1811365f (patch)
treee92191e729a3727153f1c6c89a4bbb8b32d89a8d /Swift/Controllers/Chat
parent534b7771cbfdee2fa60f6f154d578c3ef8cf2563 (diff)
downloadswift-f60d331a3e32eff632a9af3b7bd5fc1c1811365f.zip
swift-f60d331a3e32eff632a9af3b7bd5fc1c1811365f.tar.bz2
Only open chat windows when there's something to be displayed.
Resolves: #1009
Diffstat (limited to 'Swift/Controllers/Chat')
-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;
}