From 21c5075cdeec10cb5334167a5687ee533fea23b1 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 15 Feb 2016 17:34:10 +0100
Subject: Disable file-transfers to MUC PM contacts

Currently the file-transfers to MUC PM contacts fail because
the from JID does not match the initiator JID. The
initiator JID is always the real client JID at the moment.
Disabling file-transfer for MUC PM contacts provides a better
UX for now.

Test-Information:

Tested file-transfer to normal contacts still works. Tested
file-transfers to MUC PMs do not start.

Change-Id: If5f59eb313a25ca919393f497a57fd339eb17e3e

diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 6e540eb..a80eee5 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -128,7 +128,7 @@ void ChatController::handleBareJIDCapsChanged(const JID& /*jid*/) {
 	FeatureOracle featureOracle(entityCapsProvider_, presenceOracle_);
 
 	chatWindow_->setCorrectionEnabled(featureOracle.isMessageCorrectionSupported(toJID_));
-	chatWindow_->setFileTransferEnabled(featureOracle.isFileTransferSupported(toJID_));
+	chatWindow_->setFileTransferEnabled(isInMUC_ ? No : featureOracle.isFileTransferSupported(toJID_));
 	contactSupportsReceipts_ = featureOracle.isMessageReceiptsSupported(toJID_);
 
 	checkForDisplayingDisplayReceiptsAlert();
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index caa556f..a9bc2b5 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
@@ -74,9 +74,7 @@ QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventSt
 	fileTransferEnabled_ = Maybe;
 	updateTitleWithUnreadCount();
 	assert(settings);
-#ifdef SWIFT_EXPERIMENTAL_FT
 	setAcceptDrops(true);
-#endif
 
 	alertStyleSheet_ = "background: rgb(255, 255, 153); color: black";
 
@@ -590,8 +588,7 @@ void QtChatWindow::moveEvent(QMoveEvent*) {
 void QtChatWindow::dragEnterEvent(QDragEnterEvent *event) {
 	if (isOnline_ && (blockingState_ != IsBlocked)) {
 		if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) {
-			// TODO: check whether contact actually supports file transfer
-			if (!isMUC_) {
+			if (!isMUC_ && fileTransferEnabled_ == Yes) {
 				event->acceptProposedAction();
 			}
 		}
-- 
cgit v0.10.2-6-g49f6