mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Removed some code/string duplication.
This commit is contained in:
parent
6d4cc2825a
commit
3d27cf220a
@ -2189,24 +2189,23 @@ public class LocalStore extends Store implements Serializable
|
|||||||
|
|
||||||
public void deleteMessagesOlderThan(long cutoff) throws MessagingException
|
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);
|
open(OpenMode.READ_ONLY);
|
||||||
Message[] messages = LocalStore.this.getMessages(
|
Message[] messages = LocalStore.this.getMessages(
|
||||||
null,
|
null,
|
||||||
this,
|
this,
|
||||||
"SELECT " + GET_MESSAGES_COLS
|
"SELECT " + GET_MESSAGES_COLS + "FROM messages WHERE " + where,
|
||||||
+ "FROM messages WHERE folder_id = ? and date < ?", new String[]
|
params);
|
||||||
{
|
|
||||||
Long.toString(mFolderId), Long.toString(cutoff)
|
|
||||||
});
|
|
||||||
|
|
||||||
for (Message message : messages)
|
for (Message message : messages)
|
||||||
{
|
{
|
||||||
deleteAttachments(message.getUid());
|
deleteAttachments(message.getUid());
|
||||||
}
|
}
|
||||||
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
|
mDb.execSQL("DELETE FROM messages WHERE " + where, params);
|
||||||
{
|
|
||||||
Long.toString(mFolderId), new Long(cutoff)
|
|
||||||
});
|
|
||||||
resetUnreadAndFlaggedCounts();
|
resetUnreadAndFlaggedCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user