From 938317e700dbc48c227270da27afffbf1dd7ee70 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 25 Mar 2010 01:24:21 +0000 Subject: [PATCH] Get rid of the "Did not get proper search result" message. This helps with buggy IMAP servers that don't return an untagged SEARCH response if nothing was found. Other untagged responses are simply ignored. Fixes Issue 907 --- src/com/fsck/k9/mail/store/ImapStore.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 7bb3bd4a9..c691e84d8 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -912,24 +912,22 @@ public class ImapStore extends Store ArrayList messages = new ArrayList(); try { - boolean gotSearchValues = false; ArrayList uids = new ArrayList(); List responses = searcher.search(); // for (ImapResponse response : responses) { - if (response.get(0).equals("SEARCH")) + if (response.mTag == null) { - gotSearchValues = true; - for (int i = 1, count = response.size(); i < count; i++) + if (response.get(0).equals("SEARCH")) { - uids.add(Integer.parseInt(response.getString(i))); + for (int i = 1, count = response.size(); i < count; i++) + { + uids.add(Integer.parseInt(response.getString(i))); + } } } } - if (gotSearchValues == false) - { - throw new MessagingException("Did not get proper search response"); - } + // Sort the uids in numerically ascending order Collections.sort(uids); for (int i = 0, count = uids.size(); i < count; i++)