Clear visible limit when entering mailbox; enable imap load more
Bug: 7045530 Change-Id: I013c465dfbe992e9df104039e8576465805c9119
This commit is contained in:
parent
96e13d4d8c
commit
cc986cf3d7
@ -1523,7 +1523,6 @@ public class Imap2SyncService extends AbstractSyncService {
|
||||
do {
|
||||
uids[offs++] = c.getInt(0);
|
||||
} while (c.moveToNext());
|
||||
System.err.println(uids);
|
||||
return uids;
|
||||
}
|
||||
} finally {
|
||||
@ -2011,7 +2010,7 @@ public class Imap2SyncService extends AbstractSyncService {
|
||||
private int[] handleLoadMore(int[] serverList, int howManyMore) throws IOException {
|
||||
// User has asked for more; find the oldest message
|
||||
Arrays.sort(serverList);
|
||||
int oldest = serverList[serverList.length - 1];
|
||||
int oldest = serverList[0];
|
||||
// Get its current sequence number
|
||||
String tag = writeCommand(mWriter, "uid fetch " + oldest + " (UID)");
|
||||
// IMAP_OK if we want it to work
|
||||
@ -2020,8 +2019,7 @@ public class Imap2SyncService extends AbstractSyncService {
|
||||
Parser lp = new Parser(line.substring(2));
|
||||
// Last one we want is one before this message
|
||||
int end = lp.parseInteger() - 1;
|
||||
// First one is end - 9 (we want 10)
|
||||
int start = end - 9;
|
||||
int start = end - howManyMore + 1;
|
||||
if (start < 1) {
|
||||
start = 1;
|
||||
}
|
||||
@ -2029,7 +2027,7 @@ public class Imap2SyncService extends AbstractSyncService {
|
||||
// Get the uid's of the messages to load
|
||||
tag = writeCommand(mWriter, "uid search " + start + ":" + end);
|
||||
// IMAP_OK if we want it to work
|
||||
if (readResponse(mReader, tag, "SEARCH").equals(IMAP_BAD)) {
|
||||
if (readResponse(mReader, tag, "SEARCH").equals(IMAP_OK)) {
|
||||
int[] moreServerList;
|
||||
|
||||
// Parse the list
|
||||
@ -2041,6 +2039,7 @@ public class Imap2SyncService extends AbstractSyncService {
|
||||
// Length of "* search"
|
||||
Parser p = new Parser(msgs, 8);
|
||||
moreServerList = p.gatherInts();
|
||||
userLog("[Load more found " + moreServerList.length + " messages]");
|
||||
int[] completeList = new int[serverList.length + moreServerList.length];
|
||||
System.arraycopy(serverList, 0, completeList, 0, serverList.length);
|
||||
System.arraycopy(moreServerList, 0, completeList, serverList.length,
|
||||
|
@ -2693,7 +2693,7 @@ outer:
|
||||
// "load more" is valid for protocols not supporting "lookback"
|
||||
values.put(UIProvider.FolderColumns.LOAD_MORE_URI,
|
||||
uiUriString("uiloadmore", mailboxId));
|
||||
};
|
||||
}
|
||||
values.put(UIProvider.FolderColumns.CAPABILITIES,
|
||||
getFolderCapabilities(info, mailbox.mFlags, mailbox.mType, mailboxId));
|
||||
}
|
||||
@ -3261,6 +3261,15 @@ outer:
|
||||
if (visible) {
|
||||
NotificationController.getInstance(mContext).cancelNewMessageNotification(
|
||||
mMailboxId);
|
||||
// Clear the visible limit of the mailbox (if any)
|
||||
Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, mMailboxId);
|
||||
if (mailbox.mVisibleLimit > 0) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MailboxColumns.VISIBLE_LIMIT, 0);
|
||||
mContext.getContentResolver().update(
|
||||
ContentUris.withAppendedId(Mailbox.CONTENT_URI, mMailboxId),
|
||||
values, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return success
|
||||
|
Loading…
Reference in New Issue
Block a user