1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Removed some code/string duplication.

This commit is contained in:
cketti 2010-08-29 18:46:51 +00:00
parent 6d4cc2825a
commit 3d27cf220a

View File

@ -2189,24 +2189,23 @@ public class LocalStore extends Store implements Serializable
public void deleteMessagesOlderThan(long cutoff) throws MessagingException
{
final String where = "folder_id = ? and date < ?";
final String[] params = new String[] {
Long.toString(mFolderId), Long.toString(cutoff)
};
open(OpenMode.READ_ONLY);
Message[] messages = LocalStore.this.getMessages(
null,
this,
"SELECT " + GET_MESSAGES_COLS
+ "FROM messages WHERE folder_id = ? and date < ?", new String[]
{
Long.toString(mFolderId), Long.toString(cutoff)
});
"SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + where,
params);
for (Message message : messages)
{
deleteAttachments(message.getUid());
}
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
{
Long.toString(mFolderId), new Long(cutoff)
});
mDb.execSQL("DELETE FROM messages WHERE " + where, params);
resetUnreadAndFlaggedCounts();
}