mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
ant astyle
This commit is contained in:
parent
0c2e06133c
commit
3d583da450
@ -34,7 +34,7 @@ public class ActivityListener extends MessagingListener {
|
|||||||
|
|
||||||
if (mLoadingFolderName != null || mLoadingHeaderFolderName != null) {
|
if (mLoadingFolderName != null || mLoadingHeaderFolderName != null) {
|
||||||
String displayName = mLoadingFolderName;
|
String displayName = mLoadingFolderName;
|
||||||
if ((mAccount != null) && (mAccount.getInboxFolderName()!= null) && mAccount.getInboxFolderName().equalsIgnoreCase(displayName)) {
|
if ((mAccount != null) && (mAccount.getInboxFolderName() != null) && mAccount.getInboxFolderName().equalsIgnoreCase(displayName)) {
|
||||||
displayName = context.getString(R.string.special_mailbox_name_inbox);
|
displayName = context.getString(R.string.special_mailbox_name_inbox);
|
||||||
} else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
|
} else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
|
||||||
displayName = context.getString(R.string.special_mailbox_name_outbox);
|
displayName = context.getString(R.string.special_mailbox_name_outbox);
|
||||||
|
@ -1713,22 +1713,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
mQuotedText.setVisibility(View.GONE);
|
mQuotedText.setVisibility(View.GONE);
|
||||||
mQuotedHTML.setVisibility(View.GONE);
|
mQuotedHTML.setVisibility(View.GONE);
|
||||||
mQuotedTextEdit.setVisibility(View.GONE);
|
mQuotedTextEdit.setVisibility(View.GONE);
|
||||||
}
|
} else if (mQuotedTextMode == QuotedTextMode.SHOW) {
|
||||||
else if (mQuotedTextMode == QuotedTextMode.SHOW) {
|
|
||||||
mQuotedTextShow.setVisibility(View.GONE);
|
mQuotedTextShow.setVisibility(View.GONE);
|
||||||
mQuotedTextBar.setVisibility(View.VISIBLE);
|
mQuotedTextBar.setVisibility(View.VISIBLE);
|
||||||
if (mMessageFormat == MessageFormat.HTML){
|
if (mMessageFormat == MessageFormat.HTML) {
|
||||||
mQuotedText.setVisibility(View.GONE);
|
mQuotedText.setVisibility(View.GONE);
|
||||||
mQuotedHTML.setVisibility(View.VISIBLE);
|
mQuotedHTML.setVisibility(View.VISIBLE);
|
||||||
mQuotedTextEdit.setVisibility(View.VISIBLE);
|
mQuotedTextEdit.setVisibility(View.VISIBLE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mQuotedText.setVisibility(View.VISIBLE);
|
mQuotedText.setVisibility(View.VISIBLE);
|
||||||
mQuotedHTML.setVisibility(View.GONE);
|
mQuotedHTML.setVisibility(View.GONE);
|
||||||
mQuotedTextEdit.setVisibility(View.GONE);
|
mQuotedTextEdit.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
} else if (mQuotedTextMode == QuotedTextMode.HIDE) {
|
||||||
else if (mQuotedTextMode == QuotedTextMode.HIDE) {
|
|
||||||
mQuotedTextShow.setVisibility(View.VISIBLE);
|
mQuotedTextShow.setVisibility(View.VISIBLE);
|
||||||
mQuotedTextBar.setVisibility(View.GONE);
|
mQuotedTextBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
@ -2106,10 +2103,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cursorPosition = 0;
|
int cursorPosition = 0;
|
||||||
if(k9identity.containsKey(IdentityField.CURSOR_POSITION)) {
|
if (k9identity.containsKey(IdentityField.CURSOR_POSITION)) {
|
||||||
try {
|
try {
|
||||||
cursorPosition = Integer.valueOf(k9identity.get(IdentityField.CURSOR_POSITION)).intValue();
|
cursorPosition = Integer.valueOf(k9identity.get(IdentityField.CURSOR_POSITION)).intValue();
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Could not parse cursor position for MessageCompose; continuing.", e);
|
Log.e(K9.LOG_TAG, "Could not parse cursor position for MessageCompose; continuing.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2144,7 +2141,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
showOrHideQuotedText(QuotedTextMode.valueOf(showQuotedTextMode));
|
showOrHideQuotedText(QuotedTextMode.valueOf(showQuotedTextMode));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMessageFormat = MessageFormat.valueOf(messageFormat);
|
mMessageFormat = MessageFormat.valueOf(messageFormat);
|
||||||
|
|
||||||
if (mMessageFormat == MessageFormat.HTML) {
|
if (mMessageFormat == MessageFormat.HTML) {
|
||||||
@ -2193,7 +2190,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
// Set the cursor position if we have it.
|
// Set the cursor position if we have it.
|
||||||
try {
|
try {
|
||||||
mMessageContentView.setSelection(cursorPosition);
|
mMessageContentView.setSelection(cursorPosition);
|
||||||
} catch(Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Could not set cursor position in MessageCompose; ignoring.", e);
|
Log.e(K9.LOG_TAG, "Could not set cursor position in MessageCompose; ignoring.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2205,8 +2202,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
* the source message. Log it as an error, though.
|
* the source message. Log it as an error, though.
|
||||||
*/
|
*/
|
||||||
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
|
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
mSourceMessageProcessed = true;
|
mSourceMessageProcessed = true;
|
||||||
mDraftNeedsSaving = false;
|
mDraftNeedsSaving = false;
|
||||||
}
|
}
|
||||||
@ -2236,8 +2232,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
if (shown) {
|
if (shown) {
|
||||||
showOrHideQuotedText(QuotedTextMode.SHOW);
|
showOrHideQuotedText(QuotedTextMode.SHOW);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
showOrHideQuotedText(QuotedTextMode.HIDE);
|
showOrHideQuotedText(QuotedTextMode.HIDE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < chain.length; i++) {
|
for (int i = 0; i < chain.length; i++) {
|
||||||
// display certificate chain information
|
// display certificate chain information
|
||||||
//TODO: localize this strings
|
//TODO: localize this strings
|
||||||
chainInfo.append("Certificate chain[" + i + "]:\n");
|
chainInfo.append("Certificate chain[" + i + "]:\n");
|
||||||
chainInfo.append("Subject: " + chain[i].getSubjectDN().toString() + "\n");
|
chainInfo.append("Subject: " + chain[i].getSubjectDN().toString() + "\n");
|
||||||
|
|
||||||
@ -261,68 +261,68 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
// by a subjectDN not matching the server even though a
|
// by a subjectDN not matching the server even though a
|
||||||
// SubjectAltName matches)
|
// SubjectAltName matches)
|
||||||
try {
|
try {
|
||||||
final Collection<List<?>> subjectAlternativeNames = chain[i].getSubjectAlternativeNames();
|
final Collection < List<? >> subjectAlternativeNames = chain[i].getSubjectAlternativeNames();
|
||||||
if (subjectAlternativeNames != null) {
|
if (subjectAlternativeNames != null) {
|
||||||
// The list of SubjectAltNames may be very long
|
// The list of SubjectAltNames may be very long
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
StringBuffer altNamesText = new StringBuffer("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
|
StringBuffer altNamesText = new StringBuffer("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
|
||||||
|
|
||||||
// we need these for matching
|
// we need these for matching
|
||||||
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
|
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
|
||||||
String transportURIHost = (Uri.parse(mAccount.getTransportUri())).getHost();
|
String transportURIHost = (Uri.parse(mAccount.getTransportUri())).getHost();
|
||||||
|
|
||||||
for (List<?> subjectAlternativeName : subjectAlternativeNames) {
|
for (List<?> subjectAlternativeName : subjectAlternativeNames) {
|
||||||
Integer type = (Integer)subjectAlternativeName.get(0);
|
Integer type = (Integer)subjectAlternativeName.get(0);
|
||||||
Object value = subjectAlternativeName.get(1);
|
Object value = subjectAlternativeName.get(1);
|
||||||
String name = "";
|
String name = "";
|
||||||
switch (type.intValue()) {
|
switch (type.intValue()) {
|
||||||
case 0:
|
case 0:
|
||||||
Log.w(K9.LOG_TAG, "SubjectAltName of type OtherName not supported.");
|
Log.w(K9.LOG_TAG, "SubjectAltName of type OtherName not supported.");
|
||||||
continue;
|
continue;
|
||||||
case 1: // RFC822Name
|
case 1: // RFC822Name
|
||||||
name = (String)value;
|
name = (String)value;
|
||||||
break;
|
break;
|
||||||
case 2: // DNSName
|
case 2: // DNSName
|
||||||
name = (String)value;
|
name = (String)value;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type x400Address");
|
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type x400Address");
|
||||||
continue;
|
continue;
|
||||||
case 4:
|
case 4:
|
||||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type directoryName");
|
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type directoryName");
|
||||||
continue;
|
continue;
|
||||||
case 5:
|
case 5:
|
||||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type ediPartyName");
|
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of type ediPartyName");
|
||||||
continue;
|
continue;
|
||||||
case 6: // Uri
|
case 6: // Uri
|
||||||
name = (String)value;
|
name = (String)value;
|
||||||
break;
|
break;
|
||||||
case 7: // ip-address
|
case 7: // ip-address
|
||||||
name = (String)value;
|
name = (String)value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of unknown type");
|
Log.w(K9.LOG_TAG, "unsupported SubjectAltName of unknown type");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if some of the SubjectAltNames match the store or transport -host,
|
// if some of the SubjectAltNames match the store or transport -host,
|
||||||
// display them
|
// display them
|
||||||
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
|
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
altNamesText.append("Subject(alt): " + name + ",...\n");
|
altNamesText.append("Subject(alt): " + name + ",...\n");
|
||||||
} else if (name.startsWith("*.")) {
|
} else if (name.startsWith("*.")) {
|
||||||
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
|
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
altNamesText.append("Subject(alt): " + name + ",...\n");
|
altNamesText.append("Subject(alt): " + name + ",...\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chainInfo.append(altNamesText);
|
chainInfo.append(altNamesText);
|
||||||
}
|
}
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
// don't fail just because of subjectAltNames
|
// don't fail just because of subjectAltNames
|
||||||
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
|
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
chainInfo.append("Issuer: " + chain[i].getIssuerDN().toString() + "\n");
|
chainInfo.append("Issuer: " + chain[i].getIssuerDN().toString() + "\n");
|
||||||
if (sha1 != null) {
|
if (sha1 != null) {
|
||||||
|
@ -53,7 +53,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||||||
SmtpTransport.AUTH_PLAIN,
|
SmtpTransport.AUTH_PLAIN,
|
||||||
SmtpTransport.AUTH_CRAM_MD5,
|
SmtpTransport.AUTH_CRAM_MD5,
|
||||||
};
|
};
|
||||||
|
|
||||||
private EditText mUsernameView;
|
private EditText mUsernameView;
|
||||||
private EditText mPasswordView;
|
private EditText mPasswordView;
|
||||||
private EditText mServerView;
|
private EditText mServerView;
|
||||||
|
@ -3930,7 +3930,7 @@ public class MessagingController implements Runnable {
|
|||||||
if (messageUid <= localFolder.getLastUid()) {
|
if (messageUid <= localFolder.getLastUid()) {
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.d(K9.LOG_TAG, "Message uid is " + messageUid + ", max message uid is " +
|
Log.d(K9.LOG_TAG, "Message uid is " + messageUid + ", max message uid is " +
|
||||||
localFolder.getLastUid() + ". Skipping notification.");
|
localFolder.getLastUid() + ". Skipping notification.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@ -3953,7 +3953,7 @@ public class MessagingController implements Runnable {
|
|||||||
* Creates a notification of a newly received message.
|
* Creates a notification of a newly received message.
|
||||||
*/
|
*/
|
||||||
private void notifyAccount(Context context, Account account, Message message,
|
private void notifyAccount(Context context, Account account, Message message,
|
||||||
int previousUnreadMessageCount, AtomicInteger newMessageCount) {
|
int previousUnreadMessageCount, AtomicInteger newMessageCount) {
|
||||||
|
|
||||||
// If we have a message, set the notification to "<From>: <Subject>"
|
// If we have a message, set the notification to "<From>: <Subject>"
|
||||||
StringBuilder messageNotice = new StringBuilder();
|
StringBuilder messageNotice = new StringBuilder();
|
||||||
|
@ -19,11 +19,12 @@ public class FileBrowserHelper {
|
|||||||
* A string array that specifies the name of the intent to use, and the scheme to use with it
|
* A string array that specifies the name of the intent to use, and the scheme to use with it
|
||||||
* when setting the data for the intent.
|
* when setting the data for the intent.
|
||||||
*/
|
*/
|
||||||
private static final String[][] PICK_DIRECTORY_INTENTS =
|
private static final String[][] PICK_DIRECTORY_INTENTS = {
|
||||||
{ { "org.openintents.action.PICK_DIRECTORY", "file://" }, // OI File Manager (maybe others)
|
{ "org.openintents.action.PICK_DIRECTORY", "file://" }, // OI File Manager (maybe others)
|
||||||
{ "com.estrongs.action.PICK_DIRECTORY", "file://" }, // ES File Explorer
|
{ "com.estrongs.action.PICK_DIRECTORY", "file://" }, // ES File Explorer
|
||||||
{ Intent.ACTION_PICK, "folder://" }, // Blackmoon File Browser (maybe others)
|
{ Intent.ACTION_PICK, "folder://" }, // Blackmoon File Browser (maybe others)
|
||||||
{ "com.androidworkz.action.PICK_DIRECTORY", "file://" }}; // SystemExplorer
|
{ "com.androidworkz.action.PICK_DIRECTORY", "file://" }
|
||||||
|
}; // SystemExplorer
|
||||||
|
|
||||||
private static FileBrowserHelper sInstance;
|
private static FileBrowserHelper sInstance;
|
||||||
|
|
||||||
@ -82,15 +83,15 @@ public class FileBrowserHelper {
|
|||||||
do {
|
do {
|
||||||
String intentAction = PICK_DIRECTORY_INTENTS[listIndex][0];
|
String intentAction = PICK_DIRECTORY_INTENTS[listIndex][0];
|
||||||
String uriPrefix = PICK_DIRECTORY_INTENTS[listIndex][1];
|
String uriPrefix = PICK_DIRECTORY_INTENTS[listIndex][1];
|
||||||
Intent intent = new Intent(intentAction);
|
Intent intent = new Intent(intentAction);
|
||||||
intent.setData(Uri.parse(uriPrefix + startPath.getPath()));
|
intent.setData(Uri.parse(uriPrefix + startPath.getPath()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
c.startActivityForResult(intent, requestcode);
|
c.startActivityForResult(intent, requestcode);
|
||||||
success = true;
|
success = true;
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
// Try the next intent in the list
|
// Try the next intent in the list
|
||||||
listIndex++;
|
listIndex++;
|
||||||
};
|
};
|
||||||
} while (!success && (listIndex < PICK_DIRECTORY_INTENTS.length));
|
} while (!success && (listIndex < PICK_DIRECTORY_INTENTS.length));
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ public class ImapStore extends Store {
|
|||||||
decodedFolderName = decodeFolderName(response.getString(3));
|
decodedFolderName = decodeFolderName(response.getString(3));
|
||||||
} catch (CharacterCodingException e) {
|
} catch (CharacterCodingException e) {
|
||||||
Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
||||||
"as defined by RFC 3501: " + response.getString(3), e);
|
"as defined by RFC 3501: " + response.getString(3), e);
|
||||||
|
|
||||||
//TODO: Use the raw name returned by the server for all commands that require
|
//TODO: Use the raw name returned by the server for all commands that require
|
||||||
// a folder name. Use the decoded name only for showing it to the user.
|
// a folder name. Use the decoded name only for showing it to the user.
|
||||||
|
@ -505,53 +505,53 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
// Always count messages in the INBOX but exclude special folders and possibly
|
// Always count messages in the INBOX but exclude special folders and possibly
|
||||||
// more (depending on the folder display mode)
|
// more (depending on the folder display mode)
|
||||||
String baseQuery = "SELECT SUM(unread_count), SUM(flagged_count) " +
|
String baseQuery = "SELECT SUM(unread_count), SUM(flagged_count) " +
|
||||||
"FROM folders " +
|
"FROM folders " +
|
||||||
"WHERE (name = ?)" + /* INBOX */
|
"WHERE (name = ?)" + /* INBOX */
|
||||||
" OR (" +
|
" OR (" +
|
||||||
"name NOT IN (?, ?, ?, ?, ?)" + /* special folders */
|
"name NOT IN (?, ?, ?, ?, ?)" + /* special folders */
|
||||||
"%s)"; /* placeholder for additional constraints */
|
"%s)"; /* placeholder for additional constraints */
|
||||||
|
|
||||||
List<String> queryParam = new ArrayList<String>();
|
List<String> queryParam = new ArrayList<String>();
|
||||||
queryParam.add(mAccount.getInboxFolderName());
|
queryParam.add(mAccount.getInboxFolderName());
|
||||||
|
|
||||||
queryParam.add((mAccount.getTrashFolderName() != null) ?
|
queryParam.add((mAccount.getTrashFolderName() != null) ?
|
||||||
mAccount.getTrashFolderName() : "");
|
mAccount.getTrashFolderName() : "");
|
||||||
queryParam.add((mAccount.getDraftsFolderName() != null) ?
|
queryParam.add((mAccount.getDraftsFolderName() != null) ?
|
||||||
mAccount.getDraftsFolderName() : "");
|
mAccount.getDraftsFolderName() : "");
|
||||||
queryParam.add((mAccount.getSpamFolderName() != null) ?
|
queryParam.add((mAccount.getSpamFolderName() != null) ?
|
||||||
mAccount.getSpamFolderName() : "");
|
mAccount.getSpamFolderName() : "");
|
||||||
queryParam.add((mAccount.getOutboxFolderName() != null) ?
|
queryParam.add((mAccount.getOutboxFolderName() != null) ?
|
||||||
mAccount.getOutboxFolderName() : "");
|
mAccount.getOutboxFolderName() : "");
|
||||||
queryParam.add((mAccount.getSentFolderName() != null) ?
|
queryParam.add((mAccount.getSentFolderName() != null) ?
|
||||||
mAccount.getSentFolderName() : "");
|
mAccount.getSentFolderName() : "");
|
||||||
|
|
||||||
final String extraWhere;
|
final String extraWhere;
|
||||||
switch (displayMode) {
|
switch (displayMode) {
|
||||||
case FIRST_CLASS:
|
case FIRST_CLASS:
|
||||||
// Count messages in the INBOX and non-special first class folders
|
// Count messages in the INBOX and non-special first class folders
|
||||||
extraWhere = " AND (display_class = ?)";
|
extraWhere = " AND (display_class = ?)";
|
||||||
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
|
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
|
||||||
break;
|
break;
|
||||||
case FIRST_AND_SECOND_CLASS:
|
case FIRST_AND_SECOND_CLASS:
|
||||||
// Count messages in the INBOX and non-special first and second class folders
|
// Count messages in the INBOX and non-special first and second class folders
|
||||||
extraWhere = " AND (display_class IN (?, ?))";
|
extraWhere = " AND (display_class IN (?, ?))";
|
||||||
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
|
queryParam.add(Folder.FolderClass.FIRST_CLASS.name());
|
||||||
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
|
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
|
||||||
break;
|
break;
|
||||||
case NOT_SECOND_CLASS:
|
case NOT_SECOND_CLASS:
|
||||||
// Count messages in the INBOX and non-special non-second-class folders
|
// Count messages in the INBOX and non-special non-second-class folders
|
||||||
extraWhere = " AND (display_class != ?)";
|
extraWhere = " AND (display_class != ?)";
|
||||||
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
|
queryParam.add(Folder.FolderClass.SECOND_CLASS.name());
|
||||||
break;
|
break;
|
||||||
case ALL:
|
case ALL:
|
||||||
// Count messages in the INBOX and non-special folders
|
// Count messages in the INBOX and non-special folders
|
||||||
extraWhere = "";
|
extraWhere = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.e(K9.LOG_TAG, "asked to compute account statistics for an impossible folder mode " + displayMode);
|
Log.e(K9.LOG_TAG, "asked to compute account statistics for an impossible folder mode " + displayMode);
|
||||||
stats.unreadMessageCount = 0;
|
stats.unreadMessageCount = 0;
|
||||||
stats.flaggedMessageCount = 0;
|
stats.flaggedMessageCount = 0;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String query = String.format(Locale.US, baseQuery, extraWhere);
|
String query = String.format(Locale.US, baseQuery, extraWhere);
|
||||||
@ -1671,7 +1671,7 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
String encoded_name = EncoderUtil.encodeIfNecessary(name,
|
String encoded_name = EncoderUtil.encodeIfNecessary(name,
|
||||||
EncoderUtil.Usage.WORD_ENTITY, 7);
|
EncoderUtil.Usage.WORD_ENTITY, 7);
|
||||||
|
|
||||||
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
|
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
|
||||||
String.format("%s;\n name=\"%s\"",
|
String.format("%s;\n name=\"%s\"",
|
||||||
@ -2444,8 +2444,8 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
|
|
||||||
if (htmlContent != null) {
|
if (htmlContent != null) {
|
||||||
String newHtmlContent = htmlContent.replaceAll(
|
String newHtmlContent = htmlContent.replaceAll(
|
||||||
Pattern.quote("cid:" + contentId),
|
Pattern.quote("cid:" + contentId),
|
||||||
contentUri.toString());
|
contentUri.toString());
|
||||||
|
|
||||||
ContentValues cv = new ContentValues();
|
ContentValues cv = new ContentValues();
|
||||||
cv.put("html_content", newHtmlContent);
|
cv.put("html_content", newHtmlContent);
|
||||||
|
@ -681,11 +681,11 @@ public class Pop3Store extends Store {
|
|||||||
try {
|
try {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
||||||
Log.d(K9.LOG_TAG, "This server doesn't support the CAPA command. " +
|
Log.d(K9.LOG_TAG, "This server doesn't support the CAPA command. " +
|
||||||
"Checking to see if the TOP command is supported nevertheless.");
|
"Checking to see if the TOP command is supported nevertheless.");
|
||||||
}
|
}
|
||||||
|
|
||||||
response = executeSimpleCommand(String.format("TOP %d %d",
|
response = executeSimpleCommand(String.format("TOP %d %d",
|
||||||
mUidToMsgNumMap.get(message.getUid()), lines));
|
mUidToMsgNumMap.get(message.getUid()), lines));
|
||||||
|
|
||||||
// TOP command is supported. Remember this for the next time.
|
// TOP command is supported. Remember this for the next time.
|
||||||
mCapabilities.top = true;
|
mCapabilities.top = true;
|
||||||
@ -696,7 +696,7 @@ public class Pop3Store extends Store {
|
|||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "The server really doesn't support the TOP " +
|
Log.d(K9.LOG_TAG, "The server really doesn't support the TOP " +
|
||||||
"command. Using RETR instead.");
|
"command. Using RETR instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't try to use the TOP command again.
|
// Don't try to use the TOP command again.
|
||||||
|
@ -265,17 +265,17 @@ public class SmtpTransport extends Transport {
|
|||||||
if (useAuthCramMD5 || (useAutomaticAuth && authCramMD5Supported)) {
|
if (useAuthCramMD5 || (useAutomaticAuth && authCramMD5Supported)) {
|
||||||
if (!authCramMD5Supported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
if (!authCramMD5Supported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "Using CRAM_MD5 as authentication method although the " +
|
Log.d(K9.LOG_TAG, "Using CRAM_MD5 as authentication method although the " +
|
||||||
"server didn't advertise support for it in EHLO response.");
|
"server didn't advertise support for it in EHLO response.");
|
||||||
}
|
}
|
||||||
saslAuthCramMD5(mUsername, mPassword);
|
saslAuthCramMD5(mUsername, mPassword);
|
||||||
} else if (useAuthPlain || (useAutomaticAuth && authPlainSupported)) {
|
} else if (useAuthPlain || (useAutomaticAuth && authPlainSupported)) {
|
||||||
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "Using PLAIN as authentication method although the " +
|
Log.d(K9.LOG_TAG, "Using PLAIN as authentication method although the " +
|
||||||
"server didn't advertise support for it in EHLO response.");
|
"server didn't advertise support for it in EHLO response.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
saslAuthPlain(mUsername, mPassword);
|
saslAuthPlain(mUsername, mPassword);
|
||||||
} catch(MessagingException ex) {
|
} catch (MessagingException ex) {
|
||||||
// PLAIN is a special case. Historically, PLAIN has represented both PLAIN and LOGIN; only the
|
// PLAIN is a special case. Historically, PLAIN has represented both PLAIN and LOGIN; only the
|
||||||
// protocol being advertised by the server would be used, with PLAIN taking precedence. Instead
|
// protocol being advertised by the server would be used, with PLAIN taking precedence. Instead
|
||||||
// of using only the requested protocol, we'll try PLAIN and then try LOGIN.
|
// of using only the requested protocol, we'll try PLAIN and then try LOGIN.
|
||||||
@ -292,7 +292,7 @@ public class SmtpTransport extends Transport {
|
|||||||
} else if (useAuthLogin || (useAutomaticAuth && authLoginSupported)) {
|
} else if (useAuthLogin || (useAutomaticAuth && authLoginSupported)) {
|
||||||
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "Using LOGIN as authentication method although the " +
|
Log.d(K9.LOG_TAG, "Using LOGIN as authentication method although the " +
|
||||||
"server didn't advertise support for it in EHLO response.");
|
"server didn't advertise support for it in EHLO response.");
|
||||||
}
|
}
|
||||||
saslAuthLogin(mUsername, mPassword);
|
saslAuthLogin(mUsername, mPassword);
|
||||||
} else {
|
} else {
|
||||||
@ -352,20 +352,20 @@ public class SmtpTransport extends Transport {
|
|||||||
// If the message has attachments and our server has told us about a limit on
|
// If the message has attachments and our server has told us about a limit on
|
||||||
// the size of messages, count the message's size before sending it
|
// the size of messages, count the message's size before sending it
|
||||||
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
|
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
|
||||||
if (K9.DEBUG_PROTOCOL_SMTP) {
|
if (K9.DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "calculating message size");
|
Log.d(K9.LOG_TAG, "calculating message size");
|
||||||
}
|
}
|
||||||
close(); // (prevent timeouts while calculating the size)
|
close(); // (prevent timeouts while calculating the size)
|
||||||
final long calculatedSize = message.calculateSize();
|
final long calculatedSize = message.calculateSize();
|
||||||
if (calculatedSize > mLargestAcceptableMessage) {
|
if (calculatedSize > mLargestAcceptableMessage) {
|
||||||
MessagingException me = new MessagingException("Message too large for server");
|
MessagingException me = new MessagingException("Message too large for server");
|
||||||
me.setPermanentFailure(possibleSend);
|
me.setPermanentFailure(possibleSend);
|
||||||
throw me;
|
throw me;
|
||||||
}
|
}
|
||||||
open(); // (prevent timeouts while calculating the size)
|
open(); // (prevent timeouts while calculating the size)
|
||||||
if (K9.DEBUG_PROTOCOL_SMTP) {
|
if (K9.DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "calculating message size DONE size=" + calculatedSize + " max allowed=" + mLargestAcceptableMessage);
|
Log.d(K9.LOG_TAG, "calculating message size DONE size=" + calculatedSize + " max allowed=" + mLargestAcceptableMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Address[] from = message.getFrom();
|
Address[] from = message.getFrom();
|
||||||
@ -396,8 +396,8 @@ public class SmtpTransport extends Transport {
|
|||||||
// "5xx text" -responses are permanent failures
|
// "5xx text" -responses are permanent failures
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
if (msg != null && msg.startsWith("5")) {
|
if (msg != null && msg.startsWith("5")) {
|
||||||
Log.w(K9.LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
|
Log.w(K9.LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
|
||||||
possibleSend=false;
|
possibleSend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
me.setPermanentFailure(possibleSend);
|
me.setPermanentFailure(possibleSend);
|
||||||
|
@ -53,7 +53,7 @@ public class TimePickerPreference extends DialogPreference implements
|
|||||||
* @param defStyle
|
* @param defStyle
|
||||||
*/
|
*/
|
||||||
public TimePickerPreference(final Context context, final AttributeSet attrs,
|
public TimePickerPreference(final Context context, final AttributeSet attrs,
|
||||||
final int defStyle) {
|
final int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@ -78,8 +78,7 @@ public class TimePickerPreference extends DialogPreference implements
|
|||||||
tp.setOnTimeChangedListener(this);
|
tp.setOnTimeChangedListener(this);
|
||||||
originalHour = getHour();
|
originalHour = getHour();
|
||||||
originalMinute = getMinute();
|
originalMinute = getMinute();
|
||||||
if (originalHour >= 0 && originalMinute >= 0)
|
if (originalHour >= 0 && originalMinute >= 0) {
|
||||||
{
|
|
||||||
tp.setCurrentHour(originalHour);
|
tp.setCurrentHour(originalHour);
|
||||||
tp.setCurrentMinute(originalMinute);
|
tp.setCurrentMinute(originalMinute);
|
||||||
}
|
}
|
||||||
@ -104,14 +103,14 @@ public class TimePickerPreference extends DialogPreference implements
|
|||||||
* before going to super.onDialogClosed(positiveResult).
|
* before going to super.onDialogClosed(positiveResult).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onDialogClosed(boolean positiveResult) {
|
protected void onDialogClosed(boolean positiveResult) {
|
||||||
|
|
||||||
if (!positiveResult) {
|
if (!positiveResult) {
|
||||||
persistString(String.format("%02d:%02d", originalHour, originalMinute));
|
persistString(String.format("%02d:%02d", originalHour, originalMinute));
|
||||||
callChangeListener(String.format("%02d:%02d", originalHour, originalMinute));
|
callChangeListener(String.format("%02d:%02d", originalHour, originalMinute));
|
||||||
}
|
}
|
||||||
super.onDialogClosed(positiveResult);
|
super.onDialogClosed(positiveResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see android.preference.Preference#setDefaultValue(java.lang.Object)
|
* @see android.preference.Preference#setDefaultValue(java.lang.Object)
|
||||||
|
@ -74,12 +74,12 @@ public class AttachmentProvider extends ContentProvider {
|
|||||||
*/
|
*/
|
||||||
final File cacheDir = getContext().getCacheDir();
|
final File cacheDir = getContext().getCacheDir();
|
||||||
if (cacheDir == null) {
|
if (cacheDir == null) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
File[] files = cacheDir.listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
File[] files = cacheDir.listFiles();
|
|
||||||
if (files == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.getName().endsWith(".tmp")) {
|
if (file.getName().endsWith(".tmp")) {
|
||||||
file.delete();
|
file.delete();
|
||||||
|
Loading…
Reference in New Issue
Block a user