IMAP: improve uidNext implementation

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2186 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-10-10 20:38:27 +00:00
parent cbadf9653c
commit ab4a482039
1 changed files with 9 additions and 2 deletions

View File

@ -1373,6 +1373,9 @@ public abstract class ExchangeSession {
currentFolder.unreadCount = newFolder.unreadCount; currentFolder.unreadCount = newFolder.unreadCount;
currentFolder.ctag = newFolder.ctag; currentFolder.ctag = newFolder.ctag;
currentFolder.etag = newFolder.etag; currentFolder.etag = newFolder.etag;
if (newFolder.uidNext > currentFolder.uidNext) {
currentFolder.uidNext = newFolder.uidNext;
}
currentFolder.loadMessages(); currentFolder.loadMessages();
return true; return true;
} else { } else {
@ -1582,7 +1585,7 @@ public abstract class ExchangeSession {
/** /**
* Next IMAP uid * Next IMAP uid
*/ */
public int uidNext; public long uidNext;
/** /**
* recent count * recent count
*/ */
@ -1626,6 +1629,10 @@ public abstract class ExchangeSession {
recent++; recent++;
} }
} }
long computedUidNext = messages.get(messages.size() - 1).getImapUid() + 1;
if (computedUidNext > uidNext) {
uidNext = computedUidNext;
}
} }
/** /**
@ -1685,7 +1692,7 @@ public abstract class ExchangeSession {
* @return max(messageuids)+1 * @return max(messageuids)+1
*/ */
public long getUidNext() { public long getUidNext() {
return messages.get(messages.size() - 1).getImapUid() + 1; return uidNext;
} }
/** /**