1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Revert commit 180, as it tries to do math with UIDs, which doesn't work

This commit is contained in:
Jesse Vincent 2008-12-11 18:32:34 +00:00
parent ad00c9c8c9
commit 1d6fa64d51

View File

@ -304,7 +304,6 @@ public class ImapStore extends Store {
class ImapFolder extends Folder { class ImapFolder extends Folder {
private String mName; private String mName;
private int mMessageCount = -1; private int mMessageCount = -1;
private int mUIDNext = -1;
private ImapConnection mConnection; private ImapConnection mConnection;
private OpenMode mMode; private OpenMode mMode;
private boolean mExists; private boolean mExists;
@ -370,13 +369,6 @@ public class ImapStore extends Store {
if (response.mTag == null && response.get(1).equals("EXISTS")) { if (response.mTag == null && response.get(1).equals("EXISTS")) {
mMessageCount = response.getNumber(0); mMessageCount = response.getNumber(0);
} }
else if (response.mTag == null && response.size() >= 4 && response.getString(3).equalsIgnoreCase("predicted")) {
// we have a server which specifies the UID of next message that will come into this folder
// get the value for UIDNEXT in this case.
String mUIDNextStr = response.getString(2);
mUIDNext = Integer.parseInt(mUIDNextStr.substring(0, mUIDNextStr.length()-1));
}
else if (response.mTag != null && response.size() >= 2) { else if (response.mTag != null && response.size() >= 2) {
if ("[READ-ONLY]".equalsIgnoreCase(response.getString(1))) { if ("[READ-ONLY]".equalsIgnoreCase(response.getString(1))) {
mMode = OpenMode.READ_ONLY; mMode = OpenMode.READ_ONLY;
@ -572,21 +564,11 @@ public class ImapStore extends Store {
@Override @Override
public Message[] getMessages(int start, int end, MessageRetrievalListener listener) public Message[] getMessages(int start, int end, MessageRetrievalListener listener)
throws MessagingException { throws MessagingException {
int visibleLimit = end - start + 1;
if (start < 1 || end < 1 || end < start) { if (start < 1 || end < 1 || end < start) {
throw new MessagingException( throw new MessagingException(
String.format("Invalid message set %d %d", String.format("Invalid message set %d %d",
start, end)); start, end));
} }
// adjust start and end if UIDNEXT was seen in SELECT
// Note that mUIDNext will be 3 if there are 2 messages in the folder
// If there are 2 messages in the folder visibleLimit is 2
// This math avoids having to change non-store top level code
if (mUIDNext > 0) {
start = Math.max(1, mUIDNext - visibleLimit);
end = mUIDNext;
}
checkOpen(); checkOpen();
ArrayList<Message> messages = new ArrayList<Message>(); ArrayList<Message> messages = new ArrayList<Message>();
try { try {