Loading app/core/src/main/java/com/fsck/k9/preferences/SettingsImporter.java +31 −37 Original line number Diff line number Diff line Loading @@ -368,7 +368,7 @@ public class SettingsImporter { } // Write incoming server settings (storeUri) ServerSettings incoming = new ImportedServerSettings(account.incoming); ServerSettings incoming = createServerSettings(account.incoming); BackendManager backendManager = DI.get(BackendManager.class); String storeUri = backendManager.createStoreUri(incoming); putString(editor, accountKeyPrefix + AccountPreferenceSerializer.STORE_URI_KEY, Base64.encode(storeUri)); Loading @@ -387,7 +387,7 @@ public class SettingsImporter { boolean outgoingPasswordNeeded = false; if (account.outgoing != null) { // Write outgoing server settings (transportUri) ServerSettings outgoing = new ImportedServerSettings(account.outgoing); ServerSettings outgoing = createServerSettings(account.outgoing); String transportUri = backendManager.createTransportUri(outgoing); putString(editor, accountKeyPrefix + AccountPreferenceSerializer.TRANSPORT_URI_KEY, Base64.encode(transportUri)); Loading Loading @@ -1053,21 +1053,16 @@ public class SettingsImporter { return name; } private static class ImportedServerSettings extends ServerSettings { private final ImportedServer importedServer; public ImportedServerSettings(ImportedServer server) { super(ServerTypeConverter.toServerSettingsType(server.type), server.host, convertPort(server.port), convertConnectionSecurity(server.connectionSecurity), server.authenticationType, server.username, server.password, server.clientCertificateAlias); importedServer = server; } @Override public Map<String, String> getExtra() { return (importedServer.extras != null) ? private static ServerSettings createServerSettings(ImportedServer importedServer) { String type = ServerTypeConverter.toServerSettingsType(importedServer.type); int port = convertPort(importedServer.port); ConnectionSecurity connectionSecurity = convertConnectionSecurity(importedServer.connectionSecurity); Map<String, String> extra = importedServer.extras != null ? Collections.unmodifiableMap(importedServer.extras.settings) : null; return new ServerSettings(type, importedServer.host, port, connectionSecurity, importedServer.authenticationType, importedServer.username, importedServer.password, importedServer.clientCertificateAlias, extra); } private static int convertPort(String port) { Loading Loading @@ -1095,7 +1090,6 @@ public class SettingsImporter { return ConnectionSecurity.SSL_TLS_REQUIRED; } } } @VisibleForTesting static class Imported { Loading mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import java.util.Map; /** * Generic container to hold server settings. */ public class ServerSettings { public final class ServerSettings { /** * Name of the protocol these server settings belong to. Must be all lower case. */ Loading Loading
app/core/src/main/java/com/fsck/k9/preferences/SettingsImporter.java +31 −37 Original line number Diff line number Diff line Loading @@ -368,7 +368,7 @@ public class SettingsImporter { } // Write incoming server settings (storeUri) ServerSettings incoming = new ImportedServerSettings(account.incoming); ServerSettings incoming = createServerSettings(account.incoming); BackendManager backendManager = DI.get(BackendManager.class); String storeUri = backendManager.createStoreUri(incoming); putString(editor, accountKeyPrefix + AccountPreferenceSerializer.STORE_URI_KEY, Base64.encode(storeUri)); Loading @@ -387,7 +387,7 @@ public class SettingsImporter { boolean outgoingPasswordNeeded = false; if (account.outgoing != null) { // Write outgoing server settings (transportUri) ServerSettings outgoing = new ImportedServerSettings(account.outgoing); ServerSettings outgoing = createServerSettings(account.outgoing); String transportUri = backendManager.createTransportUri(outgoing); putString(editor, accountKeyPrefix + AccountPreferenceSerializer.TRANSPORT_URI_KEY, Base64.encode(transportUri)); Loading Loading @@ -1053,21 +1053,16 @@ public class SettingsImporter { return name; } private static class ImportedServerSettings extends ServerSettings { private final ImportedServer importedServer; public ImportedServerSettings(ImportedServer server) { super(ServerTypeConverter.toServerSettingsType(server.type), server.host, convertPort(server.port), convertConnectionSecurity(server.connectionSecurity), server.authenticationType, server.username, server.password, server.clientCertificateAlias); importedServer = server; } @Override public Map<String, String> getExtra() { return (importedServer.extras != null) ? private static ServerSettings createServerSettings(ImportedServer importedServer) { String type = ServerTypeConverter.toServerSettingsType(importedServer.type); int port = convertPort(importedServer.port); ConnectionSecurity connectionSecurity = convertConnectionSecurity(importedServer.connectionSecurity); Map<String, String> extra = importedServer.extras != null ? Collections.unmodifiableMap(importedServer.extras.settings) : null; return new ServerSettings(type, importedServer.host, port, connectionSecurity, importedServer.authenticationType, importedServer.username, importedServer.password, importedServer.clientCertificateAlias, extra); } private static int convertPort(String port) { Loading Loading @@ -1095,7 +1090,6 @@ public class SettingsImporter { return ConnectionSecurity.SSL_TLS_REQUIRED; } } } @VisibleForTesting static class Imported { Loading
mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import java.util.Map; /** * Generic container to hold server settings. */ public class ServerSettings { public final class ServerSettings { /** * Name of the protocol these server settings belong to. Must be all lower case. */ Loading