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

Before we delete messages earlier than the earliest acceptable date, make sure we also delete their attachments.

This commit is contained in:
Jesse Vincent 2010-08-29 16:57:57 +00:00
parent fe62812ff2
commit 6031862bad

View File

@ -2188,6 +2188,19 @@ public class LocalStore extends Store implements Serializable
public void deleteMessagesOlderThan(long cutoff) throws MessagingException public void deleteMessagesOlderThan(long cutoff) throws MessagingException
{ {
open(OpenMode.READ_ONLY); 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)
});
for (Message message : messages)
{
deleteAttachments(message.getUid());
}
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[] mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
{ {
Long.toString(mFolderId), new Long(cutoff) Long.toString(mFolderId), new Long(cutoff)