Merge WebDavTransport into WebDavStore

This commit is contained in:
cketti 2022-10-10 16:36:43 +02:00
parent 2c1ef99c7a
commit 1690781e7a
4 changed files with 7 additions and 43 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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<Message> messages) throws MessagingException {
public void sendMessage(Message message) throws MessagingException {
List<Message> messages = Collections.singletonList(message);
WebDavFolder tmpFolder = getFolder(draftsFolderProvider.getDraftsFolder());
try {
tmpFolder.open();

View file

@ -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();
}
}