From 61c5b31de95673ef943a244dc7d3ea2f93ce30c8 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Wed, 17 Feb 2010 09:51:23 +0000
Subject: Only allow non-readable messages to a chat window if they're chat
 states.


diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 9a72f1f..d7de515 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -8,6 +8,7 @@
 #include "Swift/Controllers/EventController.h"
 #include "Swift/Controllers/Chat/MUCController.h"
 #include "Swiften/Presence/PresenceSender.h"
+#include "Swiften/Elements/ChatState.h"
 
 namespace Swift {
 
@@ -133,9 +134,9 @@ void ChatsManager::handleJoinMUCRequest(const JID &muc, const String &nick) {
 void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) {
 	JID jid = message->getFrom();
 	boost::shared_ptr<MessageEvent> event(new MessageEvent(message));
-	//if (!event->isReadable()) {
-	//	return;
-	//}
+	if (!event->isReadable() && !message->getPayload<ChatState>()) {
+		return;
+	}
 
 	// Try to deliver it to a MUC
 	if (message->getType() == Message::Groupchat || message->getType() == Message::Error) {
-- 
cgit v0.10.2-6-g49f6