mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Remove unused stuff
This commit is contained in:
parent
1fcce6fb8a
commit
ec76dca57f
@ -24,7 +24,6 @@ public class MessageInfoHolder {
|
||||
public boolean selected;
|
||||
public String account;
|
||||
public String uri;
|
||||
public int threadCount;
|
||||
|
||||
// Empty constructor for comparison
|
||||
public MessageInfoHolder() {
|
||||
|
@ -510,116 +510,6 @@ public class MessagingController implements Runnable {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* List the messages in the local message store for the given folder asynchronously.
|
||||
*
|
||||
* @param account
|
||||
* @param folder
|
||||
* @param listener
|
||||
* @param threaded
|
||||
* @param threadId
|
||||
* @throws MessagingException
|
||||
*/
|
||||
public void listLocalMessages(final Account account, final String folder,
|
||||
final MessagingListener listener, final boolean threaded, final long threadId) {
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listLocalMessagesSynchronous(account, folder, listener, threaded, threadId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List the messages in the local message store for the given folder synchronously.
|
||||
*
|
||||
* @param account
|
||||
* @param folder
|
||||
* @param listener
|
||||
* @param threaded
|
||||
* @param threadId
|
||||
* @throws MessagingException
|
||||
*/
|
||||
public void listLocalMessagesSynchronous(final Account account, final String folder,
|
||||
final MessagingListener listener, boolean threaded, long threadId) {
|
||||
|
||||
for (MessagingListener l : getListeners(listener)) {
|
||||
l.listLocalMessagesStarted(account, folder);
|
||||
}
|
||||
|
||||
LocalFolder localFolder = null;
|
||||
MessageRetrievalListener retrievalListener =
|
||||
new MessageRetrievalListener() {
|
||||
List<Message> pendingMessages = new ArrayList<Message>();
|
||||
|
||||
|
||||
@Override
|
||||
public void messageStarted(String message, int number, int ofTotal) {}
|
||||
@Override
|
||||
public void messageFinished(Message message, int number, int ofTotal) {
|
||||
|
||||
if (!isMessageSuppressed(account, folder, message)) {
|
||||
pendingMessages.add(message);
|
||||
if (pendingMessages.size() > 10) {
|
||||
addPendingMessages();
|
||||
}
|
||||
|
||||
} else {
|
||||
for (MessagingListener l : getListeners(listener)) {
|
||||
l.listLocalMessagesRemoveMessage(account, folder, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void messagesFinished(int number) {
|
||||
addPendingMessages();
|
||||
}
|
||||
private void addPendingMessages() {
|
||||
for (MessagingListener l : getListeners(listener)) {
|
||||
l.listLocalMessagesAddMessages(account, folder, pendingMessages);
|
||||
}
|
||||
pendingMessages.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
try {
|
||||
LocalStore localStore = account.getLocalStore();
|
||||
localFolder = localStore.getFolder(folder);
|
||||
localFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
//Purging followed by getting requires 2 DB queries.
|
||||
//TODO: Fix getMessages to allow auto-pruning at visible limit?
|
||||
localFolder.purgeToVisibleLimit(null);
|
||||
|
||||
if (threadId != -1) {
|
||||
localFolder.getMessagesInThread(threadId, retrievalListener);
|
||||
} else if (threaded) {
|
||||
localFolder.getThreadedMessages(retrievalListener);
|
||||
} else {
|
||||
localFolder.getMessages(retrievalListener, false);
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "Got ack that callbackRunner finished");
|
||||
|
||||
for (MessagingListener l : getListeners(listener)) {
|
||||
l.listLocalMessagesFinished(account, folder);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
for (MessagingListener l : getListeners(listener)) {
|
||||
l.listLocalMessagesFailed(account, folder, e.getMessage());
|
||||
}
|
||||
addErrorMessage(account, null, e);
|
||||
} finally {
|
||||
closeFolder(localFolder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all messages in any local account which match the query 'query'
|
||||
* @throws MessagingException
|
||||
|
@ -17,7 +17,6 @@ import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.Message.RecipientType;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
||||
import com.fsck.k9.helper.DateFormatter;
|
||||
|
||||
public class MessageHelper {
|
||||
@ -87,8 +86,6 @@ public class MessageHelper {
|
||||
target.account = account.getUuid();
|
||||
target.uri = "email://messages/" + account.getAccountNumber() + "/" + message.getFolder().getName() + "/" + message.getUid();
|
||||
|
||||
target.threadCount = ((LocalMessage) message).getThreadCount();
|
||||
|
||||
} catch (MessagingException me) {
|
||||
Log.w(K9.LOG_TAG, "Unable to load message info", me);
|
||||
}
|
||||
|
@ -143,10 +143,6 @@ public abstract class Message implements Part, Body {
|
||||
return getContentType().startsWith(mimeType);
|
||||
}
|
||||
|
||||
public abstract boolean toMe();
|
||||
public abstract boolean ccMe();
|
||||
public abstract boolean bccMe();
|
||||
public abstract boolean fromMe();
|
||||
public abstract long getId();
|
||||
|
||||
public abstract String getPreview();
|
||||
@ -197,8 +193,6 @@ public abstract class Message implements Part, Body {
|
||||
|
||||
public void destroy() throws MessagingException {}
|
||||
|
||||
public abstract void saveChanges() throws MessagingException;
|
||||
|
||||
public abstract void setEncoding(String encoding) throws UnavailableStorageException;
|
||||
|
||||
public abstract void setCharset(String charset) throws MessagingException;
|
||||
@ -213,11 +207,6 @@ public abstract class Message implements Part, Body {
|
||||
return mReference;
|
||||
}
|
||||
|
||||
public boolean equalsReference(MessageReference ref) {
|
||||
MessageReference tmpReference = makeMessageReference();
|
||||
return tmpReference.equals(ref);
|
||||
}
|
||||
|
||||
public long calculateSize() {
|
||||
try {
|
||||
|
||||
|
@ -15,7 +15,6 @@ import java.util.UUID;
|
||||
|
||||
import org.apache.james.mime4j.MimeException;
|
||||
import org.apache.james.mime4j.dom.field.DateTimeField;
|
||||
import org.apache.james.mime4j.dom.field.ParsedField;
|
||||
import org.apache.james.mime4j.field.DefaultFieldParser;
|
||||
import org.apache.james.mime4j.io.EOLConvertingInputStream;
|
||||
import org.apache.james.mime4j.parser.ContentHandler;
|
||||
@ -23,7 +22,6 @@ import org.apache.james.mime4j.parser.MimeStreamParser;
|
||||
import org.apache.james.mime4j.stream.BodyDescriptor;
|
||||
import org.apache.james.mime4j.stream.Field;
|
||||
import org.apache.james.mime4j.stream.MimeConfig;
|
||||
import org.apache.james.mime4j.stream.RawField;
|
||||
|
||||
import com.fsck.k9.mail.Address;
|
||||
import com.fsck.k9.mail.Body;
|
||||
@ -345,11 +343,6 @@ public class MimeMessage extends Message {
|
||||
setHeader("References", references);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() throws MessagingException {
|
||||
throw new MessagingException("saveChanges not yet implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Body getBody() {
|
||||
return mBody;
|
||||
@ -593,22 +586,6 @@ public class MimeMessage extends Message {
|
||||
return message;
|
||||
}
|
||||
|
||||
public boolean toMe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ccMe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean bccMe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean fromMe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return Long.parseLong(mUid); //or maybe .mMessageId?
|
||||
}
|
||||
|
@ -88,15 +88,13 @@ public class LocalStore extends Store implements Serializable {
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
private static final Flag[] EMPTY_FLAG_ARRAY = new Flag[0];
|
||||
|
||||
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN, Flag.FLAGGED };
|
||||
|
||||
/*
|
||||
* a String containing the columns getMessages expects to work with
|
||||
* in the correct order.
|
||||
*/
|
||||
static private String GET_MESSAGES_COLS =
|
||||
"subject, sender_list, date, uid, flags, id, to_list, cc_list, "
|
||||
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id, folder_id, preview, thread_root, thread_parent, empty ";
|
||||
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id, folder_id, preview, thread_root, thread_parent ";
|
||||
|
||||
|
||||
static private String GET_FOLDER_COLS = "id, name, unread_count, visible_limit, last_updated, status, push_state, last_pushed, flagged_count, integrate, top_group, poll_class, push_class, display_class";
|
||||
@ -1960,76 +1958,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public Message[] getThreadedMessages(final MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
try {
|
||||
return database.execute(false, new DbCallback<Message[]>() {
|
||||
@Override
|
||||
public Message[] doDbWork(final SQLiteDatabase db) throws WrappedException,
|
||||
UnavailableStorageException {
|
||||
try {
|
||||
open(OpenMode.READ_WRITE);
|
||||
|
||||
return LocalStore.this.getMessages(
|
||||
listener,
|
||||
LocalFolder.this,
|
||||
"SELECT " +
|
||||
"m.subject, m.sender_list, MAX(m.date), m.uid, m.flags, " +
|
||||
"m.id, m.to_list, m.cc_list, m.bcc_list, m.reply_to_list, " +
|
||||
"m.attachment_count, m.internal_date, m.message_id, " +
|
||||
"m.folder_id, m.preview, m.thread_root, m.thread_parent, " +
|
||||
"m.empty, COUNT(h.id) " +
|
||||
"FROM messages h JOIN messages m " +
|
||||
"ON (h.id = m.thread_root OR h.id = m.id) " +
|
||||
"WHERE h.deleted = 0 AND m.deleted = 0 AND " +
|
||||
"(m.empty IS NULL OR m.empty != 1) AND " +
|
||||
"h.thread_root IS NULL AND h.folder_id = ? " +
|
||||
"GROUP BY h.id",
|
||||
new String[] { Long.toString(mFolderId) });
|
||||
} catch (MessagingException e) {
|
||||
throw new WrappedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (WrappedException e) {
|
||||
throw(MessagingException) e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
public Message[] getMessagesInThread(final long threadId,
|
||||
final MessageRetrievalListener listener) throws MessagingException {
|
||||
try {
|
||||
return database.execute(false, new DbCallback<Message[]>() {
|
||||
@Override
|
||||
public Message[] doDbWork(final SQLiteDatabase db) throws WrappedException,
|
||||
UnavailableStorageException {
|
||||
try {
|
||||
open(OpenMode.READ_WRITE);
|
||||
|
||||
String threadIdString = Long.toString(threadId);
|
||||
|
||||
return LocalStore.this.getMessages(
|
||||
listener,
|
||||
LocalFolder.this,
|
||||
"SELECT " + GET_MESSAGES_COLS + " " +
|
||||
"FROM messages " +
|
||||
"WHERE deleted = 0 AND (empty IS NULL OR empty != 1) AND " +
|
||||
"(thread_root = ? OR id = ?) AND folder_id = ?",
|
||||
new String[] {
|
||||
threadIdString,
|
||||
threadIdString,
|
||||
Long.toString(mFolderId)
|
||||
});
|
||||
} catch (MessagingException e) {
|
||||
throw new WrappedException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (WrappedException e) {
|
||||
throw(MessagingException) e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message[] getMessages(String[] uids, MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
@ -2125,11 +2053,11 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
cv.clear();
|
||||
cv.put("thread_root", id);
|
||||
int x = db.update("messages", cv, "thread_root = ?", oldIdArg);
|
||||
db.update("messages", cv, "thread_root = ?", oldIdArg);
|
||||
|
||||
cv.clear();
|
||||
cv.put("thread_parent", id);
|
||||
x = db.update("messages", cv, "thread_parent = ?", oldIdArg);
|
||||
db.update("messages", cv, "thread_parent = ?", oldIdArg);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3303,23 +3231,11 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
private String mPreview = "";
|
||||
|
||||
private boolean mToMeCalculated = false;
|
||||
private boolean mCcMeCalculated = false;
|
||||
private boolean mFromMeCalculated = false;
|
||||
private boolean mToMe = false;
|
||||
private boolean mCcMe = false;
|
||||
private boolean mFromMe = false;
|
||||
|
||||
|
||||
|
||||
|
||||
private boolean mHeadersLoaded = false;
|
||||
private boolean mMessageDirty = false;
|
||||
|
||||
private long mRootId;
|
||||
private long mParentId;
|
||||
private boolean mEmpty;
|
||||
private int mThreadCount = 0;
|
||||
|
||||
public LocalMessage() {
|
||||
}
|
||||
@ -3377,12 +3293,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
mRootId = (cursor.isNull(15)) ? -1 : cursor.getLong(15);
|
||||
mParentId = (cursor.isNull(16)) ? -1 : cursor.getLong(16);
|
||||
|
||||
mEmpty = (cursor.isNull(17)) ? false : (cursor.getInt(17) == 1);
|
||||
|
||||
if (cursor.getColumnCount() > 18) {
|
||||
mThreadCount = cursor.getInt(18);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3522,64 +3432,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
mMessageDirty = true;
|
||||
}
|
||||
|
||||
|
||||
public boolean fromMe() {
|
||||
if (!mFromMeCalculated) {
|
||||
if (mAccount.isAnIdentity(getFrom())) {
|
||||
mFromMe = true;
|
||||
mFromMeCalculated = true;
|
||||
}
|
||||
}
|
||||
return mFromMe;
|
||||
}
|
||||
|
||||
|
||||
public boolean toMe() {
|
||||
try {
|
||||
if (!mToMeCalculated) {
|
||||
for (Address address : getRecipients(RecipientType.TO)) {
|
||||
if (mAccount.isAnIdentity(address)) {
|
||||
mToMe = true;
|
||||
mToMeCalculated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
return mToMe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean ccMe() {
|
||||
try {
|
||||
|
||||
if (!mCcMeCalculated) {
|
||||
for (Address address : getRecipients(RecipientType.CC)) {
|
||||
if (mAccount.isAnIdentity(address)) {
|
||||
mCcMe = true;
|
||||
mCcMeCalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
|
||||
return mCcMe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void setFlagInternal(Flag flag, boolean set) throws MessagingException {
|
||||
super.setFlag(flag, set);
|
||||
}
|
||||
@ -3886,10 +3738,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
message.mAttachmentCount = mAttachmentCount;
|
||||
message.mSubject = mSubject;
|
||||
message.mPreview = mPreview;
|
||||
message.mToMeCalculated = mToMeCalculated;
|
||||
message.mCcMeCalculated = mCcMeCalculated;
|
||||
message.mToMe = mToMe;
|
||||
message.mCcMe = mCcMe;
|
||||
message.mHeadersLoaded = mHeadersLoaded;
|
||||
message.mMessageDirty = mMessageDirty;
|
||||
|
||||
@ -3903,14 +3751,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
public long getParentId() {
|
||||
return mParentId;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return mEmpty;
|
||||
}
|
||||
|
||||
public int getThreadCount() {
|
||||
return mThreadCount;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LocalAttachmentBodyPart extends MimeBodyPart {
|
||||
|
Loading…
Reference in New Issue
Block a user