Skip to content

Commit

Permalink
Fixed UID mapping return value of LocalStore.moveMessages()
Browse files Browse the repository at this point in the history
  • Loading branch information
cketti committed Feb 16, 2012
1 parent 4ed77c7 commit 023c605
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/com/fsck/k9/mail/store/LocalStore.java
Expand Up @@ -1963,18 +1963,26 @@ public Void doDbWork(final SQLiteDatabase db) throws WrappedException, Unavailab
Log.d(K9.LOG_TAG, "Updating folder_id to " + lDestFolder.getId() + " for message with UID "
+ message.getUid() + ", id " + lMessage.getId() + " currently in folder " + getName());

message.setUid(K9.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
String newUid = K9.LOCAL_UID_PREFIX + UUID.randomUUID().toString();
message.setUid(newUid);

uidMap.put(oldUID, newUid);

db.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[] {
lDestFolder.getId(),
message.getUid(),
lMessage.getId()
});

/*
* Add a placeholder message so we won't download the original
* message again if we synchronize before the remote move is
* complete.
*/
LocalMessage placeHolder = new LocalMessage(oldUID, LocalFolder.this);
placeHolder.setFlagInternal(Flag.DELETED, true);
placeHolder.setFlagInternal(Flag.SEEN, true);
uidMap.putAll(appendMessages(new Message[] { placeHolder }));
appendMessages(new Message[] { placeHolder });
}
} catch (MessagingException e) {
throw new WrappedException(e);
Expand Down

0 comments on commit 023c605

Please sign in to comment.