mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Fixes to unbreak incoming account setup after CRAM_MD5 implementation
This commit is contained in:
parent
361cc4cbb1
commit
8fca99bef4
@ -52,6 +52,12 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
"webdav", "webdav+ssl", "webdav+ssl+", "webdav+tls", "webdav+tls+"
|
"webdav", "webdav+ssl", "webdav+ssl+", "webdav+tls", "webdav+tls+"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final String authTypes[] =
|
||||||
|
{
|
||||||
|
"PLAIN", "CRAM_MD5"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
private int mAccountPorts[];
|
private int mAccountPorts[];
|
||||||
private String mAccountSchemes[];
|
private String mAccountSchemes[];
|
||||||
private EditText mUsernameView;
|
private EditText mUsernameView;
|
||||||
@ -128,7 +134,9 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
new SpinnerOption(4, getString(R.string.account_setup_incoming_security_tls_label)),
|
new SpinnerOption(4, getString(R.string.account_setup_incoming_security_tls_label)),
|
||||||
};
|
};
|
||||||
|
|
||||||
SpinnerOption authTypes[] =
|
// This needs to be kept in sync with the list at the top of the file.
|
||||||
|
// that makes me somewhat unhappy
|
||||||
|
SpinnerOption authTypeSpinnerOptions[] =
|
||||||
{
|
{
|
||||||
new SpinnerOption(0, "PLAIN"),
|
new SpinnerOption(0, "PLAIN"),
|
||||||
new SpinnerOption(1, "CRAM_MD5")
|
new SpinnerOption(1, "CRAM_MD5")
|
||||||
@ -140,7 +148,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||||
|
|
||||||
ArrayAdapter<SpinnerOption> authTypesAdapter = new ArrayAdapter<SpinnerOption>(this,
|
ArrayAdapter<SpinnerOption> authTypesAdapter = new ArrayAdapter<SpinnerOption>(this,
|
||||||
android.R.layout.simple_spinner_item, authTypes);
|
android.R.layout.simple_spinner_item, authTypeSpinnerOptions);
|
||||||
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
mAuthTypeView.setAdapter(authTypesAdapter);
|
mAuthTypeView.setAdapter(authTypesAdapter);
|
||||||
|
|
||||||
@ -206,15 +214,29 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
URI uri = new URI(mAccount.getStoreUri());
|
URI uri = new URI(mAccount.getStoreUri());
|
||||||
String username = null;
|
String username = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
|
String authType = null;
|
||||||
|
|
||||||
if (uri.getUserInfo() != null)
|
if (uri.getUserInfo() != null)
|
||||||
{
|
{
|
||||||
String[] userInfoParts = uri.getUserInfo().split(":", 2);
|
String[] userInfoParts = uri.getUserInfo().split(":");
|
||||||
username = userInfoParts[0];
|
if (userInfoParts.length == 3)
|
||||||
if (userInfoParts.length > 1)
|
|
||||||
{
|
{
|
||||||
|
authType = userInfoParts[0];
|
||||||
|
username = userInfoParts[1];
|
||||||
|
password = userInfoParts[2];
|
||||||
|
}
|
||||||
|
else if (userInfoParts.length == 2)
|
||||||
|
{
|
||||||
|
username = userInfoParts[0];
|
||||||
password = userInfoParts[1];
|
password = userInfoParts[1];
|
||||||
}
|
}
|
||||||
|
else if (userInfoParts.length == 1)
|
||||||
|
{
|
||||||
|
username = userInfoParts[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (username != null)
|
if (username != null)
|
||||||
{
|
{
|
||||||
@ -226,6 +248,18 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||||||
mPasswordView.setText(password);
|
mPasswordView.setText(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authType != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < authTypes.length; i++)
|
||||||
|
{
|
||||||
|
if (authTypes[i].equals(authType))
|
||||||
|
{
|
||||||
|
SpinnerOption.setSpinnerOptionValue(mAuthTypeView, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mImapFolderDrafts.setText(mAccount.getDraftsFolderName());
|
mImapFolderDrafts.setText(mAccount.getDraftsFolderName());
|
||||||
mImapFolderSent.setText(mAccount.getSentFolderName());
|
mImapFolderSent.setText(mAccount.getSentFolderName());
|
||||||
mImapFolderTrash.setText(mAccount.getTrashFolderName());
|
mImapFolderTrash.setText(mAccount.getTrashFolderName());
|
||||||
|
Loading…
Reference in New Issue
Block a user