am 9a2686af
: Improve POP sync.
* commit '9a2686afa2e02c62a8e5f9c42c82bd2da70b96af': Improve POP sync.
This commit is contained in:
commit
fdb583ab6c
@ -106,7 +106,6 @@ class ImapConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mTransport.open();
|
mTransport.open();
|
||||||
mTransport.setSoTimeout(MailTransport.SOCKET_READ_TIMEOUT);
|
|
||||||
|
|
||||||
createParser();
|
createParser();
|
||||||
|
|
||||||
@ -498,7 +497,6 @@ class ImapConnection {
|
|||||||
executeSimpleCommand(ImapConstants.STARTTLS);
|
executeSimpleCommand(ImapConstants.STARTTLS);
|
||||||
|
|
||||||
mTransport.reopenTls();
|
mTransport.reopenTls();
|
||||||
mTransport.setSoTimeout(MailTransport.SOCKET_READ_TIMEOUT);
|
|
||||||
createParser();
|
createParser();
|
||||||
// Per RFC requirement (3501-6.2.1) gather new capabilities
|
// Per RFC requirement (3501-6.2.1) gather new capabilities
|
||||||
return(queryCapabilities());
|
return(queryCapabilities());
|
||||||
|
@ -123,7 +123,7 @@ public class MailTransport {
|
|||||||
}
|
}
|
||||||
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
||||||
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
|
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
|
||||||
|
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
|
||||||
} catch (SSLException e) {
|
} catch (SSLException e) {
|
||||||
if (MailActivityEmail.DEBUG) {
|
if (MailActivityEmail.DEBUG) {
|
||||||
Log.d(Logging.LOG_TAG, e.toString());
|
Log.d(Logging.LOG_TAG, e.toString());
|
||||||
|
@ -205,8 +205,10 @@ public class Pop3Service extends Service {
|
|||||||
// We'll load them from most recent to oldest
|
// We'll load them from most recent to oldest
|
||||||
for (int i = cnt - 1; i >= 0; i--) {
|
for (int i = cnt - 1; i >= 0; i--) {
|
||||||
Pop3Message message = unsyncedMessages.get(i);
|
Pop3Message message = unsyncedMessages.get(i);
|
||||||
remoteFolder.fetchBody(message, Pop3Store.FETCH_BODY_SANE_SUGGESTED_SIZE / 76,
|
// TODO: this fetches the entire message at once. This should go back to trying
|
||||||
null);
|
// to avoid downloading attachments initially. Specifically, the second argument
|
||||||
|
// below used to be Pop3Store.FETCH_BODY_SANE_SUGGESTED_SIZE / 76
|
||||||
|
remoteFolder.fetchBody(message, -1, null);
|
||||||
int flag = EmailContent.Message.FLAG_LOADED_COMPLETE;
|
int flag = EmailContent.Message.FLAG_LOADED_COMPLETE;
|
||||||
if (!message.isComplete()) {
|
if (!message.isComplete()) {
|
||||||
flag = EmailContent.Message.FLAG_LOADED_UNKNOWN;
|
flag = EmailContent.Message.FLAG_LOADED_UNKNOWN;
|
||||||
@ -266,10 +268,8 @@ public class Pop3Service extends Service {
|
|||||||
localUidCursor = resolver.query(
|
localUidCursor = resolver.query(
|
||||||
EmailContent.Message.CONTENT_URI,
|
EmailContent.Message.CONTENT_URI,
|
||||||
LocalMessageInfo.PROJECTION,
|
LocalMessageInfo.PROJECTION,
|
||||||
EmailContent.MessageColumns.ACCOUNT_KEY + "=?" +
|
MessageColumns.MAILBOX_KEY + "=?",
|
||||||
" AND " + MessageColumns.MAILBOX_KEY + "=?",
|
|
||||||
new String[] {
|
new String[] {
|
||||||
String.valueOf(account.mId),
|
|
||||||
String.valueOf(mailbox.mId)
|
String.valueOf(mailbox.mId)
|
||||||
},
|
},
|
||||||
null);
|
null);
|
||||||
@ -356,9 +356,9 @@ public class Pop3Service extends Service {
|
|||||||
remoteUidMap.put(uid, message);
|
remoteUidMap.put(uid, message);
|
||||||
LocalMessageInfo localMessage = localMessageMap.get(uid);
|
LocalMessageInfo localMessage = localMessageMap.get(uid);
|
||||||
// localMessage == null -> message has never been created (not even headers)
|
// localMessage == null -> message has never been created (not even headers)
|
||||||
// mFlagLoaded = UNLOADED -> message created, but none of body loaded
|
// mFlagLoaded != FLAG_LOADED_COMPLETE -> message failed to sync completely
|
||||||
if (localMessage == null ||
|
if (localMessage == null ||
|
||||||
(localMessage.mFlagLoaded == EmailContent.Message.FLAG_LOADED_UNLOADED)) {
|
(localMessage.mFlagLoaded != EmailContent.Message.FLAG_LOADED_COMPLETE)) {
|
||||||
unsyncedMessages.add(message);
|
unsyncedMessages.add(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,6 +366,7 @@ public class Pop3Service extends Service {
|
|||||||
if (MailActivityEmail.DEBUG) {
|
if (MailActivityEmail.DEBUG) {
|
||||||
Log.d(TAG, "*** Message count is zero??");
|
Log.d(TAG, "*** Message count is zero??");
|
||||||
}
|
}
|
||||||
|
remoteFolder.close(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user