Issue 234
Fix POP3 deletes. Verizon uses - in their POP3 UIDs, and K9 was assuming that only Local UIDs have -. Removed that assumption. Also, after issuing DELE on POP3 connection, need to also issue a QUIT. The delete code in MessagingController now closes the folder after deleting a message, which will slow down IMAP deletes, but also conserve connections, so is probably a net benefit.
This commit is contained in:
parent
718e27dab9
commit
97a4f97b64
3 changed files with 20 additions and 14 deletions
|
@ -99,6 +99,14 @@ public class Email extends Application {
|
|||
*/
|
||||
public static final String FOLDER_NONE = "-NONE-";
|
||||
|
||||
|
||||
// The next time the LocalStore.java DB_VERSION is incremented, please delete the current
|
||||
// LOCAL_UID_PREFIX and this comment, and uncomment the K9LOCAL: version of this static string
|
||||
public static final String LOCAL_UID_PREFIX = "Local";
|
||||
//public static final String LOCAL_UID_PREFIX = "K9LOCAL:";
|
||||
|
||||
public static final String REMOTE_UID_PREFIX = "K9REMOTE:";
|
||||
|
||||
/**
|
||||
* Specifies how many messages will be shown in a folder by default. This number is set
|
||||
* on each new folder and can be incremented with "Load more messages..." by the
|
||||
|
|
|
@ -1323,8 +1323,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
}
|
||||
|
||||
Message remoteMessage = null;
|
||||
if (!localMessage.getUid().startsWith("Local")
|
||||
&& !localMessage.getUid().contains("-")) {
|
||||
if (!localMessage.getUid().startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
remoteMessage = remoteFolder.getMessage(localMessage.getUid());
|
||||
}
|
||||
|
||||
|
@ -1453,8 +1452,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
}
|
||||
|
||||
Message remoteMessage = null;
|
||||
if (!uid.startsWith("Local")
|
||||
&& !uid.contains("-")) {
|
||||
if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
// Why bother with this, perhaps just pass the UID to the store to save a roundtrip? And check for error returns, of course
|
||||
// Same applies for deletion
|
||||
remoteMessage = remoteSrcFolder.getMessage(uid);
|
||||
|
@ -1473,6 +1471,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
{
|
||||
Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy doing special case for deleting message");
|
||||
remoteMessage.delete(account.getTrashFolderName());
|
||||
remoteSrcFolder.close(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1524,8 +1523,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
return;
|
||||
}
|
||||
Message remoteMessage = null;
|
||||
if (!uid.startsWith("Local")
|
||||
&& !uid.contains("-")) {
|
||||
if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
remoteMessage = remoteFolder.getMessage(uid);
|
||||
}
|
||||
if (remoteMessage == null) {
|
||||
|
@ -2245,8 +2243,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
public boolean moveMessage(final Account account, final String srcFolder, final Message message, final String destFolder,
|
||||
final MessagingListener listener)
|
||||
{
|
||||
if (!message.getUid().startsWith("Local")
|
||||
&& !message.getUid().contains("-")) {
|
||||
if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
put("moveMessage", null, new Runnable() {
|
||||
public void run() {
|
||||
moveOrCopyMessageSynchronous(account, srcFolder, message, destFolder, false, listener);
|
||||
|
@ -2261,8 +2258,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
}
|
||||
|
||||
public boolean isMoveCapable(Message message) {
|
||||
if (!message.getUid().startsWith("Local")
|
||||
&& !message.getUid().contains("-")) {
|
||||
if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -2304,8 +2300,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||
public boolean copyMessage(final Account account, final String srcFolder, final Message message, final String destFolder,
|
||||
final MessagingListener listener)
|
||||
{
|
||||
if (!message.getUid().startsWith("Local")
|
||||
&& !message.getUid().contains("-")) {
|
||||
if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) {
|
||||
put("copyMessage", null, new Runnable() {
|
||||
public void run() {
|
||||
moveOrCopyMessageSynchronous(account, srcFolder, message, destFolder, true, listener);
|
||||
|
|
|
@ -63,6 +63,9 @@ import com.android.email.provider.AttachmentProvider;
|
|||
* </pre>
|
||||
*/
|
||||
public class LocalStore extends Store implements Serializable {
|
||||
// If you are going to change the DB_VERSION, please also go into Email.java and local for the comment
|
||||
// on LOCAL_UID_PREFIX and follow the instructions there. If you follow the instructions there,
|
||||
// please delete this comment.
|
||||
private static final int DB_VERSION = 24;
|
||||
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN };
|
||||
|
||||
|
@ -1011,7 +1014,7 @@ public class LocalStore extends Store implements Serializable {
|
|||
Log.d(Email.LOG_TAG, "Updating folder_id to " + lDestFolder.getId() + " for message with UID "
|
||||
+ message.getUid() + ", id " + lMessage.getId() + " currently in folder " + getName());
|
||||
|
||||
message.setUid("Local" + UUID.randomUUID().toString());
|
||||
message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
|
||||
|
||||
mDb.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[] {
|
||||
lDestFolder.getId(),
|
||||
|
@ -1051,7 +1054,7 @@ public class LocalStore extends Store implements Serializable {
|
|||
|
||||
String uid = message.getUid();
|
||||
if (uid == null) {
|
||||
message.setUid("Local" + UUID.randomUUID().toString());
|
||||
message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
|
||||
}
|
||||
else {
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue