1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 09:52:16 -05:00

review comments, also use == in preference to equals for enums

This commit is contained in:
Art O Cathain 2015-02-22 21:30:26 +00:00
parent 1a706c3113
commit 5035e7e3d1
14 changed files with 39 additions and 55 deletions

View File

@ -5,6 +5,7 @@ import android.content.Context;
import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory; import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory;
import com.fsck.k9.mail.store.StoreConfig; import com.fsck.k9.mail.store.StoreConfig;
import com.fsck.k9.mail.ServerSettings.Type;
import com.fsck.k9.mail.transport.SmtpTransport; import com.fsck.k9.mail.transport.SmtpTransport;
import com.fsck.k9.mail.transport.WebDavTransport; import com.fsck.k9.mail.transport.WebDavTransport;
@ -63,9 +64,9 @@ public abstract class Transport {
* @see WebDavTransport#createUri(ServerSettings) * @see WebDavTransport#createUri(ServerSettings)
*/ */
public static String createTransportUri(ServerSettings server) { public static String createTransportUri(ServerSettings server) {
if (SmtpTransport.TRANSPORT_TYPE.equals(server.type)) { if (Type.SMTP == server.type) {
return SmtpTransport.createUri(server); return SmtpTransport.createUri(server);
} else if (WebDavTransport.TRANSPORT_TYPE.equals(server.type)) { } else if (Type.WebDAV == server.type) {
return WebDavTransport.createUri(server); return WebDavTransport.createUri(server);
} else { } else {
throw new IllegalArgumentException("Not a valid transport URI"); throw new IllegalArgumentException("Not a valid transport URI");

View File

@ -5,6 +5,7 @@ import android.net.ConnectivityManager;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.ServerSettings.Type;
import com.fsck.k9.mail.Store; import com.fsck.k9.mail.Store;
import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory; import com.fsck.k9.mail.ssl.DefaultTrustedSocketFactory;
import com.fsck.k9.mail.ssl.TrustedSocketFactory; import com.fsck.k9.mail.ssl.TrustedSocketFactory;
@ -121,11 +122,11 @@ public abstract class RemoteStore extends Store {
* @see com.fsck.k9.mail.store.webdav.WebDavStore#createUri(com.fsck.k9.mail.ServerSettings) * @see com.fsck.k9.mail.store.webdav.WebDavStore#createUri(com.fsck.k9.mail.ServerSettings)
*/ */
public static String createStoreUri(ServerSettings server) { public static String createStoreUri(ServerSettings server) {
if (ImapStore.STORE_TYPE.equals(server.type)) { if (Type.IMAP == server.type) {
return ImapStore.createUri(server); return ImapStore.createUri(server);
} else if (Pop3Store.STORE_TYPE.equals(server.type)) { } else if (Type.POP3 == server.type) {
return Pop3Store.createUri(server); return Pop3Store.createUri(server);
} else if (WebDavStore.STORE_TYPE.equals(server.type)) { } else if (Type.WebDAV == server.type) {
return WebDavStore.createUri(server); return WebDavStore.createUri(server);
} else { } else {
throw new IllegalArgumentException("Not a valid store URI"); throw new IllegalArgumentException("Not a valid store URI");

View File

@ -77,7 +77,6 @@ import static com.fsck.k9.mail.K9MailLib.PUSH_WAKE_LOCK_TIMEOUT;
* </pre> * </pre>
*/ */
public class ImapStore extends RemoteStore { public class ImapStore extends RemoteStore {
public static final ServerSettings.Type STORE_TYPE = ServerSettings.Type.IMAP;
private static final int IDLE_READ_TIMEOUT_INCREMENT = 5 * 60 * 1000; private static final int IDLE_READ_TIMEOUT_INCREMENT = 5 * 60 * 1000;
private static final int IDLE_FAILURE_COUNT_LIMIT = 10; private static final int IDLE_FAILURE_COUNT_LIMIT = 10;
@ -284,7 +283,7 @@ public class ImapStore extends RemoteStore {
protected ImapStoreSettings(String host, int port, ConnectionSecurity connectionSecurity, protected ImapStoreSettings(String host, int port, ConnectionSecurity connectionSecurity,
AuthType authenticationType, String username, String password, String clientCertificateAlias, AuthType authenticationType, String username, String password, String clientCertificateAlias,
boolean autodetectNamespace, String pathPrefix) { boolean autodetectNamespace, String pathPrefix) {
super(STORE_TYPE, host, port, connectionSecurity, authenticationType, username, super(Type.IMAP, host, port, connectionSecurity, authenticationType, username,
password, clientCertificateAlias); password, clientCertificateAlias);
this.autoDetectNamespace = autodetectNamespace; this.autoDetectNamespace = autodetectNamespace;
this.pathPrefix = pathPrefix; this.pathPrefix = pathPrefix;

View File

@ -38,7 +38,6 @@ import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability; import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability;
public class Pop3Store extends RemoteStore { public class Pop3Store extends RemoteStore {
public static final ServerSettings.Type STORE_TYPE = ServerSettings.Type.POP3;
private static final String STLS_COMMAND = "STLS"; private static final String STLS_COMMAND = "STLS";
private static final String USER_COMMAND = "USER"; private static final String USER_COMMAND = "USER";
@ -140,7 +139,7 @@ public class Pop3Store extends RemoteStore {
} }
} }
return new ServerSettings(STORE_TYPE, host, port, connectionSecurity, authType, username, return new ServerSettings(ServerSettings.Type.POP3, host, port, connectionSecurity, authType, username,
password, clientCertificateAlias); password, clientCertificateAlias);
} }

View File

@ -58,7 +58,6 @@ import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
* </pre> * </pre>
*/ */
public class WebDavStore extends RemoteStore { public class WebDavStore extends RemoteStore {
public static final ServerSettings.Type STORE_TYPE = ServerSettings.Type.WebDAV;
// Authentication types // Authentication types
private static final short AUTH_TYPE_NONE = 0; private static final short AUTH_TYPE_NONE = 0;
@ -248,7 +247,7 @@ public class WebDavStore extends RemoteStore {
protected WebDavStoreSettings(String host, int port, ConnectionSecurity connectionSecurity, protected WebDavStoreSettings(String host, int port, ConnectionSecurity connectionSecurity,
AuthType authenticationType, String username, String password, String clientCertificateAlias, String alias, AuthType authenticationType, String username, String password, String clientCertificateAlias, String alias,
String path, String authPath, String mailboxPath) { String path, String authPath, String mailboxPath) {
super(STORE_TYPE, host, port, connectionSecurity, authenticationType, username, super(Type.WebDAV, host, port, connectionSecurity, authenticationType, username,
password, clientCertificateAlias); password, clientCertificateAlias);
this.alias = alias; this.alias = alias;
this.path = path; this.path = path;

View File

@ -32,8 +32,6 @@ import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapa
public class SmtpTransport extends Transport { public class SmtpTransport extends Transport {
private TrustedSocketFactory mTrustedSocketFactory; private TrustedSocketFactory mTrustedSocketFactory;
public static final ServerSettings.Type TRANSPORT_TYPE = ServerSettings.Type.SMTP;
/** /**
* Decodes a SmtpTransport URI. * Decodes a SmtpTransport URI.
* *
@ -115,7 +113,7 @@ public class SmtpTransport extends Transport {
} }
} }
return new ServerSettings(TRANSPORT_TYPE, host, port, connectionSecurity, return new ServerSettings(ServerSettings.Type.SMTP, host, port, connectionSecurity,
authType, username, password, clientCertificateAlias); authType, username, password, clientCertificateAlias);
} }

View File

@ -16,7 +16,6 @@ import java.util.Collections;
import static com.fsck.k9.mail.K9MailLib.LOG_TAG; import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
public class WebDavTransport extends Transport { public class WebDavTransport extends Transport {
public static final ServerSettings.Type TRANSPORT_TYPE = WebDavStore.STORE_TYPE;
/** /**
* Decodes a WebDavTransport URI. * Decodes a WebDavTransport URI.

View File

@ -13,19 +13,16 @@ import java.util.Map;
*/ */
public class AccountCreator { public class AccountCreator {
private static Map<Type, DeletePolicy> defaults; private static Map<Type, DeletePolicy> defaults = new HashMap<Type, DeletePolicy>();
public static DeletePolicy calculateDefaultDeletePolicy(Type type) { static {
return getDefaults().get(type);
}
private static synchronized Map<Type, DeletePolicy> getDefaults() {
if (null == defaults) {
defaults = new HashMap<Type, DeletePolicy>();
defaults.put(Type.IMAP, DeletePolicy.ON_DELETE); defaults.put(Type.IMAP, DeletePolicy.ON_DELETE);
defaults.put(Type.POP3, DeletePolicy.NEVER); defaults.put(Type.POP3, DeletePolicy.NEVER);
defaults.put(Type.WebDAV, DeletePolicy.ON_DELETE); defaults.put(Type.WebDAV, DeletePolicy.ON_DELETE);
} }
return defaults;
public static DeletePolicy calculateDefaultDeletePolicy(Type type) {
return defaults.get(type);
} }
} }

View File

@ -81,7 +81,6 @@ import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mail.store.RemoteStore;
import com.fsck.k9.mailstore.StorageManager; import com.fsck.k9.mailstore.StorageManager;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import com.fsck.k9.preferences.SettingsExporter; import com.fsck.k9.preferences.SettingsExporter;
import com.fsck.k9.preferences.SettingsImportExportException; import com.fsck.k9.preferences.SettingsImportExportException;
import com.fsck.k9.preferences.SettingsImporter; import com.fsck.k9.preferences.SettingsImporter;
@ -779,7 +778,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
* Also don't ask when the AuthType is EXTERNAL. * Also don't ask when the AuthType is EXTERNAL.
*/ */
boolean configureOutgoingServer = AuthType.EXTERNAL != outgoing.authenticationType boolean configureOutgoingServer = AuthType.EXTERNAL != outgoing.authenticationType
&& !WebDavStore.STORE_TYPE.equals(outgoing.type) && !(ServerSettings.Type.WebDAV == outgoing.type)
&& outgoing.username != null && outgoing.username != null
&& !outgoing.username.isEmpty() && !outgoing.username.isEmpty()
&& (outgoing.password == null || outgoing.password && (outgoing.password == null || outgoing.password

View File

@ -27,7 +27,6 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.EmailAddressValidator; import com.fsck.k9.EmailAddressValidator;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
@ -40,9 +39,7 @@ import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.store.imap.ImapStore;
import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mail.store.RemoteStore;
import com.fsck.k9.mail.transport.SmtpTransport;
import com.fsck.k9.account.AccountCreator; import com.fsck.k9.account.AccountCreator;
import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner;
import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener;
@ -410,9 +407,9 @@ public class AccountSetupBasics extends K9Activity
// set default uris // set default uris
// NOTE: they will be changed again in AccountSetupAccountType! // NOTE: they will be changed again in AccountSetupAccountType!
ServerSettings storeServer = new ServerSettings(ImapStore.STORE_TYPE, "mail." + domain, -1, ServerSettings storeServer = new ServerSettings(ServerSettings.Type.IMAP, "mail." + domain, -1,
ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias); ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias);
ServerSettings transportServer = new ServerSettings(SmtpTransport.TRANSPORT_TYPE, "mail." + domain, -1, ServerSettings transportServer = new ServerSettings(ServerSettings.Type.SMTP, "mail." + domain, -1,
ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias); ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias);
String storeUri = RemoteStore.createStoreUri(storeServer); String storeUri = RemoteStore.createStoreUri(storeServer);
String transportUri = Transport.createTransportUri(transportServer); String transportUri = Transport.createTransportUri(transportServer);

View File

@ -24,15 +24,12 @@ import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.ServerSettings.Type;
import com.fsck.k9.mail.Store; import com.fsck.k9.mail.Store;
import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.store.imap.ImapStore;
import com.fsck.k9.mail.store.pop3.Pop3Store;
import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mail.store.RemoteStore;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import com.fsck.k9.mail.store.imap.ImapStore.ImapStoreSettings; import com.fsck.k9.mail.store.imap.ImapStore.ImapStoreSettings;
import com.fsck.k9.mail.store.webdav.WebDavStore.WebDavStoreSettings; import com.fsck.k9.mail.store.webdav.WebDavStore.WebDavStoreSettings;
import com.fsck.k9.mail.transport.SmtpTransport;
import com.fsck.k9.account.AccountCreator; import com.fsck.k9.account.AccountCreator;
import com.fsck.k9.service.MailService; import com.fsck.k9.service.MailService;
import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner;
@ -56,7 +53,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
private static final String WEBDAV_PORT = "80"; private static final String WEBDAV_PORT = "80";
private static final String WEBDAV_SSL_PORT = "443"; private static final String WEBDAV_SSL_PORT = "443";
private ServerSettings.Type mStoreType; private Type mStoreType;
private EditText mUsernameView; private EditText mUsernameView;
private EditText mPasswordView; private EditText mPasswordView;
private ClientCertificateSpinner mClientCertificateSpinner; private ClientCertificateSpinner mClientCertificateSpinner;
@ -190,7 +187,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
} }
mStoreType = settings.type; mStoreType = settings.type;
if (Pop3Store.STORE_TYPE.equals(settings.type)) { if (Type.POP3 == settings.type) {
serverLabelView.setText(R.string.account_setup_incoming_pop_server_label); serverLabelView.setText(R.string.account_setup_incoming_pop_server_label);
mDefaultPort = POP3_PORT; mDefaultPort = POP3_PORT;
mDefaultSslPort = POP3_SSL_PORT; mDefaultSslPort = POP3_SSL_PORT;
@ -202,7 +199,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.compression_section).setVisibility(View.GONE); findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE); findViewById(R.id.compression_label).setVisibility(View.GONE);
mSubscribedFoldersOnly.setVisibility(View.GONE); mSubscribedFoldersOnly.setVisibility(View.GONE);
} else if (ImapStore.STORE_TYPE.equals(settings.type)) { } else if (Type.IMAP == settings.type) {
serverLabelView.setText(R.string.account_setup_incoming_imap_server_label); serverLabelView.setText(R.string.account_setup_incoming_imap_server_label);
mDefaultPort = IMAP_PORT; mDefaultPort = IMAP_PORT;
mDefaultSslPort = IMAP_SSL_PORT; mDefaultSslPort = IMAP_SSL_PORT;
@ -222,7 +219,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) {
findViewById(R.id.imap_folder_setup_section).setVisibility(View.GONE); findViewById(R.id.imap_folder_setup_section).setVisibility(View.GONE);
} }
} else if (WebDavStore.STORE_TYPE.equals(settings.type)) { } else if (Type.WebDAV == settings.type) {
serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label); serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label);
mDefaultPort = WEBDAV_PORT; mDefaultPort = WEBDAV_PORT;
mDefaultSslPort = WEBDAV_SSL_PORT; mDefaultSslPort = WEBDAV_SSL_PORT;
@ -550,7 +547,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
} }
URI oldUri = new URI(mAccount.getTransportUri()); URI oldUri = new URI(mAccount.getTransportUri());
ServerSettings transportServer = new ServerSettings(SmtpTransport.TRANSPORT_TYPE, oldUri.getHost(), oldUri.getPort(), ServerSettings transportServer = new ServerSettings(Type.SMTP, oldUri.getHost(), oldUri.getPort(),
ConnectionSecurity.SSL_TLS_REQUIRED, authType, username, password, clientCertificateAlias); ConnectionSecurity.SSL_TLS_REQUIRED, authType, username, password, clientCertificateAlias);
String transportUri = Transport.createTransportUri(transportServer); String transportUri = Transport.createTransportUri(transportServer);
mAccount.setTransportUri(transportUri); mAccount.setTransportUri(transportUri);
@ -586,13 +583,13 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
int port = Integer.parseInt(mPortView.getText().toString()); int port = Integer.parseInt(mPortView.getText().toString());
Map<String, String> extra = null; Map<String, String> extra = null;
if (ImapStore.STORE_TYPE.equals(mStoreType)) { if (Type.IMAP == mStoreType) {
extra = new HashMap<String, String>(); extra = new HashMap<String, String>();
extra.put(ImapStoreSettings.AUTODETECT_NAMESPACE_KEY, extra.put(ImapStoreSettings.AUTODETECT_NAMESPACE_KEY,
Boolean.toString(mImapAutoDetectNamespaceView.isChecked())); Boolean.toString(mImapAutoDetectNamespaceView.isChecked()));
extra.put(ImapStoreSettings.PATH_PREFIX_KEY, extra.put(ImapStoreSettings.PATH_PREFIX_KEY,
mImapPathPrefixView.getText().toString()); mImapPathPrefixView.getText().toString());
} else if (WebDavStore.STORE_TYPE.equals(mStoreType)) { } else if (Type.WebDAV == mStoreType) {
extra = new HashMap<String, String>(); extra = new HashMap<String, String>();
extra.put(WebDavStoreSettings.PATH_KEY, extra.put(WebDavStoreSettings.PATH_KEY,
mWebdavPathPrefixView.getText().toString()); mWebdavPathPrefixView.getText().toString());

View File

@ -20,10 +20,10 @@ import com.fsck.k9.activity.K9Activity;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.helper.Utility; import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.ServerSettings.Type;
import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.transport.SmtpTransport;
import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner;
import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener;
@ -485,8 +485,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
String newHost = mServerView.getText().toString(); String newHost = mServerView.getText().toString();
int newPort = Integer.parseInt(mPortView.getText().toString()); int newPort = Integer.parseInt(mPortView.getText().toString());
ServerSettings.Type type = SmtpTransport.TRANSPORT_TYPE; ServerSettings server = new ServerSettings(Type.SMTP, newHost, newPort, securityType, authType, username, password, clientCertificateAlias);
ServerSettings server = new ServerSettings(type, newHost, newPort, securityType, authType, username, password, clientCertificateAlias);
uri = Transport.createTransportUri(server); uri = Transport.createTransportUri(server);
mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING); mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
mAccount.setTransportUri(uri); mAccount.setTransportUri(uri);

View File

@ -28,7 +28,6 @@ import com.fsck.k9.mail.ServerSettings;
import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.filter.Base64; import com.fsck.k9.mail.filter.Base64;
import com.fsck.k9.mail.store.RemoteStore; import com.fsck.k9.mail.store.RemoteStore;
import com.fsck.k9.mail.store.webdav.WebDavStore;
import com.fsck.k9.preferences.Settings.InvalidSettingValueException; import com.fsck.k9.preferences.Settings.InvalidSettingValueException;
public class SettingsImporter { public class SettingsImporter {
@ -384,7 +383,7 @@ public class SettingsImporter {
boolean createAccountDisabled = AuthType.EXTERNAL != incoming.authenticationType && boolean createAccountDisabled = AuthType.EXTERNAL != incoming.authenticationType &&
(incoming.password == null || incoming.password.isEmpty()); (incoming.password == null || incoming.password.isEmpty());
if (account.outgoing == null && !WebDavStore.STORE_TYPE.name().equals(account.incoming.type)) { if (account.outgoing == null && !ServerSettings.Type.WebDAV.name().equals(account.incoming.type)) {
// All account types except WebDAV need to provide outgoing server settings // All account types except WebDAV need to provide outgoing server settings
throw new InvalidSettingValueException(); throw new InvalidSettingValueException();
} }
@ -403,7 +402,7 @@ public class SettingsImporter {
* password required if the AuthType is EXTERNAL. * password required if the AuthType is EXTERNAL.
*/ */
boolean outgoingPasswordNeeded = AuthType.EXTERNAL != outgoing.authenticationType && boolean outgoingPasswordNeeded = AuthType.EXTERNAL != outgoing.authenticationType &&
!WebDavStore.STORE_TYPE.equals(outgoing.type) && !(ServerSettings.Type.WebDAV == outgoing.type) &&
outgoing.username != null && outgoing.username != null &&
!outgoing.username.isEmpty() && !outgoing.username.isEmpty() &&
(outgoing.password == null || outgoing.password.isEmpty()); (outgoing.password == null || outgoing.password.isEmpty());

View File

@ -91,7 +91,7 @@ public class ImapStoreUriTest {
extra.put("autoDetectNamespace", "false"); extra.put("autoDetectNamespace", "false");
extra.put("pathPrefix", "customPathPrefix"); extra.put("pathPrefix", "customPathPrefix");
ServerSettings settings = new ServerSettings(ImapStore.STORE_TYPE, "server", 143, ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143,
ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra); ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra);
String uri = RemoteStore.createStoreUri(settings); String uri = RemoteStore.createStoreUri(settings);
@ -105,7 +105,7 @@ public class ImapStoreUriTest {
extra.put("autoDetectNamespace", "false"); extra.put("autoDetectNamespace", "false");
extra.put("pathPrefix", ""); extra.put("pathPrefix", "");
ServerSettings settings = new ServerSettings(ImapStore.STORE_TYPE, "server", 143, ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143,
ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra); ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra);
String uri = RemoteStore.createStoreUri(settings); String uri = RemoteStore.createStoreUri(settings);
@ -115,7 +115,7 @@ public class ImapStoreUriTest {
@Test @Test
public void testCreateStoreUriImapNoExtra() { public void testCreateStoreUriImapNoExtra() {
ServerSettings settings = new ServerSettings(ImapStore.STORE_TYPE, "server", 143, ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143,
ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null); ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null);
String uri = RemoteStore.createStoreUri(settings); String uri = RemoteStore.createStoreUri(settings);
@ -128,7 +128,7 @@ public class ImapStoreUriTest {
Map<String, String> extra = new HashMap<String, String>(); Map<String, String> extra = new HashMap<String, String>();
extra.put("autoDetectNamespace", "true"); extra.put("autoDetectNamespace", "true");
ServerSettings settings = new ServerSettings(ImapStore.STORE_TYPE, "server", 143, ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143,
ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra); ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra);
String uri = RemoteStore.createStoreUri(settings); String uri = RemoteStore.createStoreUri(settings);
@ -138,7 +138,7 @@ public class ImapStoreUriTest {
@Test @Test
public void testCreateDecodeStoreUriWithSpecialCharactersInUsernameAndPassword() { public void testCreateDecodeStoreUriWithSpecialCharactersInUsernameAndPassword() {
ServerSettings settings = new ServerSettings(ImapStore.STORE_TYPE, "server", 143, ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143,
ConnectionSecurity.NONE, AuthType.PLAIN, "user@doma:n", "p@ssw:rd%", null, null); ConnectionSecurity.NONE, AuthType.PLAIN, "user@doma:n", "p@ssw:rd%", null, null);
String uri = RemoteStore.createStoreUri(settings); String uri = RemoteStore.createStoreUri(settings);