mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Code style fixes
This commit is contained in:
parent
7b5c73b43c
commit
abbad18283
@ -1,5 +1,6 @@
|
|||||||
package com.fsck.k9.mailstore;
|
package com.fsck.k9.mailstore;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -17,10 +18,6 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.fsck.k9.mail.internet.MimeMessageHelper;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.james.mime4j.util.MimeUtil;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -30,10 +27,9 @@ import android.net.Uri;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.Account;
|
import com.fsck.k9.Account;
|
||||||
import com.fsck.k9.K9;
|
|
||||||
import com.fsck.k9.Account.MessageFormat;
|
import com.fsck.k9.Account.MessageFormat;
|
||||||
|
import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.activity.Search;
|
import com.fsck.k9.activity.Search;
|
||||||
import com.fsck.k9.mail.MessageRetrievalListener;
|
|
||||||
import com.fsck.k9.helper.HtmlConverter;
|
import com.fsck.k9.helper.HtmlConverter;
|
||||||
import com.fsck.k9.helper.Utility;
|
import com.fsck.k9.helper.Utility;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
@ -43,18 +39,22 @@ import com.fsck.k9.mail.FetchProfile;
|
|||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mail.Folder;
|
import com.fsck.k9.mail.Folder;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
|
import com.fsck.k9.mail.Message.RecipientType;
|
||||||
|
import com.fsck.k9.mail.MessageRetrievalListener;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
import com.fsck.k9.mail.Message.RecipientType;
|
|
||||||
import com.fsck.k9.mail.internet.MimeBodyPart;
|
import com.fsck.k9.mail.internet.MimeBodyPart;
|
||||||
import com.fsck.k9.mail.internet.MimeHeader;
|
import com.fsck.k9.mail.internet.MimeHeader;
|
||||||
import com.fsck.k9.mail.internet.MimeMessage;
|
import com.fsck.k9.mail.internet.MimeMessage;
|
||||||
|
import com.fsck.k9.mail.internet.MimeMessageHelper;
|
||||||
import com.fsck.k9.mail.internet.MimeMultipart;
|
import com.fsck.k9.mail.internet.MimeMultipart;
|
||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
import com.fsck.k9.mail.internet.MimeUtility;
|
||||||
import com.fsck.k9.mail.internet.TextBody;
|
import com.fsck.k9.mail.internet.TextBody;
|
||||||
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
|
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
|
||||||
import com.fsck.k9.mailstore.LockableDatabase.WrappedException;
|
import com.fsck.k9.mailstore.LockableDatabase.WrappedException;
|
||||||
import com.fsck.k9.provider.AttachmentProvider;
|
import com.fsck.k9.provider.AttachmentProvider;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.james.mime4j.util.MimeUtil;
|
||||||
|
|
||||||
|
|
||||||
public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
||||||
@ -210,10 +210,8 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
public Boolean doDbWork(final SQLiteDatabase db) throws WrappedException {
|
public Boolean doDbWork(final SQLiteDatabase db) throws WrappedException {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
cursor = db.rawQuery("SELECT id FROM folders "
|
cursor = db.rawQuery("SELECT id FROM folders where folders.name = ?",
|
||||||
+ "where folders.name = ?", new String[] { LocalFolder.
|
new String[] { LocalFolder.this.getName() });
|
||||||
this.getName()
|
|
||||||
});
|
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
int folderId = cursor.getInt(0);
|
int folderId = cursor.getInt(0);
|
||||||
return (folderId > 0);
|
return (folderId > 0);
|
||||||
@ -271,10 +269,10 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
}
|
}
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
cursor = db.rawQuery("SELECT COUNT(id) FROM messages WHERE (empty IS NULL OR empty != 1) AND deleted = 0 and folder_id = ?",
|
cursor = db.rawQuery(
|
||||||
new String[] {
|
"SELECT COUNT(id) FROM messages " +
|
||||||
Long.toString(mFolderId)
|
"WHERE (empty IS NULL OR empty != 1) AND deleted = 0 and folder_id = ?",
|
||||||
});
|
new String[] { Long.toString(mFolderId) });
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return cursor.getInt(0); //messagecount
|
return cursor.getInt(0); //messagecount
|
||||||
} finally {
|
} finally {
|
||||||
@ -283,7 +281,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (WrappedException e) {
|
} catch (WrappedException e) {
|
||||||
throw(MessagingException) e.getCause();
|
throw (MessagingException) e.getCause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,6 +401,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
public void setStatus(final String status) throws MessagingException {
|
public void setStatus(final String status) throws MessagingException {
|
||||||
updateFolderColumn("status", status);
|
updateFolderColumn("status", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPushState(final String pushState) throws MessagingException {
|
public void setPushState(final String pushState) throws MessagingException {
|
||||||
mPushState = pushState;
|
mPushState = pushState;
|
||||||
updateFolderColumn("push_state", pushState);
|
updateFolderColumn("push_state", pushState);
|
||||||
@ -465,7 +464,6 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
public void setDisplayClass(FolderClass displayClass) throws MessagingException {
|
public void setDisplayClass(FolderClass displayClass) throws MessagingException {
|
||||||
mDisplayClass = displayClass;
|
mDisplayClass = displayClass;
|
||||||
updateFolderColumn("display_class", mDisplayClass.name());
|
updateFolderColumn("display_class", mDisplayClass.name());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSyncClass(FolderClass syncClass) throws MessagingException {
|
public void setSyncClass(FolderClass syncClass) throws MessagingException {
|
||||||
@ -503,7 +501,6 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
private String getPrefId() throws MessagingException {
|
private String getPrefId() throws MessagingException {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
return getPrefId(mName);
|
return getPrefId(mName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete() throws MessagingException {
|
public void delete() throws MessagingException {
|
||||||
@ -606,7 +603,6 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
}
|
}
|
||||||
prefHolder.inTopGroup = preferences.getBoolean(id + ".inTopGroup", prefHolder.inTopGroup);
|
prefHolder.inTopGroup = preferences.getBoolean(id + ".inTopGroup", prefHolder.inTopGroup);
|
||||||
prefHolder.integrate = preferences.getBoolean(id + ".integrate", prefHolder.integrate);
|
prefHolder.integrate = preferences.getBoolean(id + ".integrate", prefHolder.integrate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -847,14 +843,13 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
Long id = message.getId();
|
Long id = message.getId();
|
||||||
ids.add(Long.toString(id));
|
ids.add(Long.toString(id));
|
||||||
popMessages.put(id, message);
|
popMessages.put(id, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = db.rawQuery(
|
cursor = db.rawQuery(
|
||||||
"SELECT message_id, name, value FROM headers " + "WHERE message_id in ( " + questions + ") ORDER BY id ASC",
|
"SELECT message_id, name, value FROM headers " +
|
||||||
|
"WHERE message_id in ( " + questions + ") ORDER BY id ASC",
|
||||||
ids.toArray(LocalStore.EMPTY_STRING_ARRAY));
|
ids.toArray(LocalStore.EMPTY_STRING_ARRAY));
|
||||||
|
|
||||||
|
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
Long id = cursor.getLong(0);
|
Long id = cursor.getLong(0);
|
||||||
String name = cursor.getString(1);
|
String name = cursor.getString(1);
|
||||||
@ -881,11 +876,8 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
cursor = db.rawQuery(
|
cursor = db.rawQuery(
|
||||||
"SELECT uid FROM messages " +
|
"SELECT uid FROM messages WHERE id = ? AND folder_id = ?",
|
||||||
"WHERE id = ? AND folder_id = ?",
|
new String[] { Long.toString(id), Long.toString(mFolderId) });
|
||||||
new String[] {
|
|
||||||
Long.toString(id), Long.toString(mFolderId)
|
|
||||||
});
|
|
||||||
if (!cursor.moveToNext()) {
|
if (!cursor.moveToNext()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -921,9 +913,8 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
"FROM messages " +
|
"FROM messages " +
|
||||||
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
||||||
"WHERE uid = ? AND folder_id = ?",
|
"WHERE uid = ? AND folder_id = ?",
|
||||||
new String[] {
|
new String[] { message.getUid(), Long.toString(mFolderId) });
|
||||||
message.getUid(), Long.toString(mFolderId)
|
|
||||||
});
|
|
||||||
if (!cursor.moveToNext()) {
|
if (!cursor.moveToNext()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -955,17 +946,14 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
public List<LocalMessage> doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
|
public List<LocalMessage> doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
|
||||||
try {
|
try {
|
||||||
open(OPEN_MODE_RW);
|
open(OPEN_MODE_RW);
|
||||||
return LocalFolder.this.localStore.getMessages(
|
return LocalFolder.this.localStore.getMessages(listener, LocalFolder.this,
|
||||||
listener,
|
|
||||||
LocalFolder.this,
|
|
||||||
"SELECT " + LocalStore.GET_MESSAGES_COLS +
|
"SELECT " + LocalStore.GET_MESSAGES_COLS +
|
||||||
"FROM messages " +
|
"FROM messages " +
|
||||||
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
||||||
"WHERE (empty IS NULL OR empty != 1) AND " +
|
"WHERE (empty IS NULL OR empty != 1) AND " +
|
||||||
(includeDeleted ? "" : "deleted = 0 AND ") +
|
(includeDeleted ? "" : "deleted = 0 AND ") +
|
||||||
"folder_id = ? ORDER BY date DESC",
|
"folder_id = ? ORDER BY date DESC",
|
||||||
new String[] { Long.toString(mFolderId) }
|
new String[] { Long.toString(mFolderId) });
|
||||||
);
|
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
throw new WrappedException(e);
|
throw new WrappedException(e);
|
||||||
}
|
}
|
||||||
@ -1502,8 +1490,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
appendedFlags.add(Flag.X_GOT_ALL_HEADERS);
|
appendedFlags.add(Flag.X_GOT_ALL_HEADERS);
|
||||||
|
|
||||||
db.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?",
|
db.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?",
|
||||||
new Object[]
|
new Object[] { LocalFolder.this.localStore.serializeFlags(appendedFlags), id });
|
||||||
{ LocalFolder.this.localStore.serializeFlags(appendedFlags), id });
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1514,8 +1501,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
this.localStore.database.execute(false, new DbCallback<Void>() {
|
this.localStore.database.execute(false, new DbCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
|
public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
|
||||||
db.execSQL("DELETE FROM headers WHERE message_id = ?", new Object[]
|
db.execSQL("DELETE FROM headers WHERE message_id = ?", new Object[] { id });
|
||||||
{ id });
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1776,17 +1762,12 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||||||
public void clearMessagesOlderThan(long cutoff) throws MessagingException {
|
public void clearMessagesOlderThan(long cutoff) throws MessagingException {
|
||||||
open(OPEN_MODE_RO);
|
open(OPEN_MODE_RO);
|
||||||
|
|
||||||
List<? extends Message> messages = this.localStore.getMessages(
|
List<? extends Message> messages = this.localStore.getMessages(null, this,
|
||||||
null,
|
|
||||||
this,
|
|
||||||
"SELECT " + LocalStore.GET_MESSAGES_COLS +
|
"SELECT " + LocalStore.GET_MESSAGES_COLS +
|
||||||
"FROM messages " +
|
"FROM messages " +
|
||||||
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
"LEFT JOIN threads ON (threads.message_id = messages.id) " +
|
||||||
"WHERE (empty IS NULL OR empty != 1) AND " +
|
"WHERE (empty IS NULL OR empty != 1) AND (folder_id = ? and date < ?)",
|
||||||
"(folder_id = ? and date < ?)",
|
new String[] { Long.toString(mFolderId), Long.toString(cutoff) });
|
||||||
new String[] {
|
|
||||||
Long.toString(mFolderId), Long.toString(cutoff)
|
|
||||||
});
|
|
||||||
|
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
message.destroy();
|
message.destroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user