diff --git a/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt b/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt index 0e4e588e3..f8bf8f7bf 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt @@ -8,7 +8,6 @@ import com.fsck.k9.mail.ssl.TrustManagerFactory import com.fsck.k9.mail.store.webdav.DraftsFolderProvider import com.fsck.k9.mail.store.webdav.SniHostSetter import com.fsck.k9.mail.store.webdav.WebDavStore -import com.fsck.k9.mail.transport.WebDavTransport import com.fsck.k9.mailstore.FolderRepository import com.fsck.k9.mailstore.K9BackendStorageFactory @@ -24,8 +23,7 @@ class WebDavBackendFactory( val serverSettings = account.incomingServerSettings val draftsFolderProvider = createDraftsFolderProvider(account) val webDavStore = WebDavStore(trustManagerFactory, sniHostSetter, serverSettings, draftsFolderProvider) - val webDavTransport = WebDavTransport(trustManagerFactory, sniHostSetter, serverSettings, draftsFolderProvider) - return WebDavBackend(accountName, backendStorage, webDavStore, webDavTransport) + return WebDavBackend(accountName, backendStorage, webDavStore) } private fun createDraftsFolderProvider(account: Account): DraftsFolderProvider { diff --git a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavBackend.kt b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavBackend.kt index 6e855653a..79a9d666f 100644 --- a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavBackend.kt +++ b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavBackend.kt @@ -13,13 +13,11 @@ import com.fsck.k9.mail.Message import com.fsck.k9.mail.MessagingException import com.fsck.k9.mail.Part import com.fsck.k9.mail.store.webdav.WebDavStore -import com.fsck.k9.mail.transport.WebDavTransport class WebDavBackend( accountName: String, backendStorage: BackendStorage, - private val webDavStore: WebDavStore, - private val webDavTransport: WebDavTransport + private val webDavStore: WebDavStore ) : Backend { private val webDavSync: WebDavSync = WebDavSync(accountName, backendStorage, webDavStore) private val commandGetFolders = CommandRefreshFolderList(backendStorage, webDavStore) @@ -139,11 +137,11 @@ class WebDavBackend( } override fun sendMessage(message: Message) { - webDavTransport.sendMessage(message) + webDavStore.sendMessage(message) } override fun checkOutgoingServerSettings() { - webDavTransport.checkSettings() + webDavStore.checkSettings() } override fun createPusher(callback: BackendPusherCallback): BackendPusher { diff --git a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java b/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java index 7a6fdada9..aafe20641 100644 --- a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java +++ b/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java @@ -11,6 +11,7 @@ import java.net.URISyntaxException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -937,7 +938,8 @@ public class WebDavStore { return dataset; } - public void sendMessages(List messages) throws MessagingException { + public void sendMessage(Message message) throws MessagingException { + List messages = Collections.singletonList(message); WebDavFolder tmpFolder = getFolder(draftsFolderProvider.getDraftsFolder()); try { tmpFolder.open(); diff --git a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/transport/WebDavTransport.java b/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/transport/WebDavTransport.java deleted file mode 100644 index 1cf6d38c4..000000000 --- a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/transport/WebDavTransport.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fsck.k9.mail.transport; - - -import java.util.Collections; - -import com.fsck.k9.logging.Timber; -import com.fsck.k9.mail.K9MailLib; -import com.fsck.k9.mail.Message; -import com.fsck.k9.mail.MessagingException; -import com.fsck.k9.mail.ServerSettings; -import com.fsck.k9.mail.ssl.TrustManagerFactory; -import com.fsck.k9.mail.store.webdav.DraftsFolderProvider; -import com.fsck.k9.mail.store.webdav.SniHostSetter; -import com.fsck.k9.mail.store.webdav.WebDavStore; - -public class WebDavTransport { - private WebDavStore store; - - public WebDavTransport(TrustManagerFactory trustManagerFactory, SniHostSetter sniHostSetter, - ServerSettings serverSettings, DraftsFolderProvider draftsFolderProvider) { - store = new WebDavStore(trustManagerFactory, sniHostSetter, serverSettings, draftsFolderProvider); - - if (K9MailLib.isDebug()) - Timber.d(">>> New WebDavTransport creation complete"); - } - - public void sendMessage(Message message) throws MessagingException { - store.sendMessages(Collections.singletonList(message)); - } - - public void checkSettings() throws MessagingException { - store.checkSettings(); - } -}