diff --git a/src/api/datatransfermodel.h b/src/api/datatransfermodel.h index fee2fc7ca07619fd1548e92b60abf67775d8db33..250f6dfd4cb70699d7202134466914e0a378c187 100644 --- a/src/api/datatransfermodel.h +++ b/src/api/datatransfermodel.h @@ -90,21 +90,6 @@ public: */ static QString createDefaultDirectory(); - /** - * Accept transfer from untrusted contacts - */ - bool acceptFromUnstrusted {false}; - - /** - * Accept transfer from trusted contacts - */ - bool automaticAcceptTransfer {true}; - - /** - * Automatically accept transfer under - */ - unsigned acceptBehindMb {20} /* Mb */; - Q_SIGNALS: /** * Connect this signal to know when a data transfer is incoming. diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h index c8a0e17af458c899536f5a9da657247a77bc6a18..3f85bb1c9a0fa330f25882cecbdc73b317b317a8 100644 --- a/src/api/newaccountmodel.h +++ b/src/api/newaccountmodel.h @@ -77,6 +77,18 @@ public: * Should contains the full directory with the end marker (/ on linux for example) */ QString downloadDirectory; + /** + * Accept transfer from untrusted contacts + */ + bool autoTransferFromUnstrusted {false}; + /** + * Accept transfer from trusted contacts + */ + bool autoTransferFromTrusted {true}; + /** + * Automatically accept transfer under + */ + unsigned autoTransferSizeThreshold {20} /* Mb */; /** * set account enable/disable, save config and do unregister for account * @param accountId. diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp index db87e34a2b9b0bb8fcd6f6bbdf44a70ae3936706..8e9dfb68405d1c5c6514a615529b7b1a6300c8d7 100644 --- a/src/conversationmodel.cpp +++ b/src/conversationmodel.cpp @@ -3582,7 +3582,7 @@ ConversationModelPimpl::awaitingHost(const QString& fileId, datatransfer::Info i auto conversationIdx = indexOf(conversationId); auto& peers = peersForConversation(conversations[conversationIdx]); // Only accept if contact is added or it is a group conversation - if (linked.owner.dataTransferModel->acceptFromUnstrusted && peers.size() == 1) { + if (linked.owner.accountModel->autoTransferFromUnstrusted && peers.size() == 1) { try { auto contactUri = peers.front(); auto contactInfo = linked.owner.contactModel->getContact(contactUri); @@ -3602,11 +3602,11 @@ ConversationModelPimpl::handleIncomingFile(const QString& convId, int totalSize) { // If it's an accepted file type and less than 20 MB, accept transfer. - if (linked.owner.dataTransferModel->automaticAcceptTransfer) { - if (linked.owner.dataTransferModel->acceptBehindMb == 0 + if (linked.owner.accountModel->autoTransferFromTrusted) { + if (linked.owner.accountModel->autoTransferSizeThreshold == 0 || (totalSize > 0 && static_cast<unsigned>(totalSize) - < linked.owner.dataTransferModel->acceptBehindMb * 1024 * 1024)) { + < linked.owner.accountModel->autoTransferSizeThreshold * 1024 * 1024)) { acceptTransfer(convId, interactionId, displayName); } }