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

Merge pull request #323 from jca02266/adapt_broken_server

Adapt broken pop3 server
This commit is contained in:
cketti 2013-07-07 19:43:55 -07:00
commit 306b258f25

View File

@ -567,8 +567,13 @@ public class Pop3Store extends Store {
Pop3Message message = mMsgNumToMsgMap.get(msgNum); Pop3Message message = mMsgNumToMsgMap.get(msgNum);
if (message == null) { if (message == null) {
String response = executeSimpleCommand(UIDL_COMMAND + " " + msgNum); String response = executeSimpleCommand(UIDL_COMMAND + " " + msgNum);
int uidIndex = response.lastIndexOf(' '); // response = "+OK msgNum msgUid"
String msgUid = response.substring(uidIndex + 1); String[] uidParts = response.split(" +");
if (uidParts.length < 3 || !"+OK".equals(uidParts[0])) {
Log.e(K9.LOG_TAG, "ERR response: " + response);
return;
}
String msgUid = uidParts[2];
message = new Pop3Message(msgUid, this); message = new Pop3Message(msgUid, this);
indexMessage(msgNum, message); indexMessage(msgNum, message);
} }
@ -642,7 +647,7 @@ public class Pop3Store extends Store {
if (response.equals(".")) { if (response.equals(".")) {
break; break;
} }
String[] uidParts = response.split(" "); String[] uidParts = response.split(" +");
// Ignore messages without a unique-id // Ignore messages without a unique-id
if (uidParts.length >= 2) { if (uidParts.length >= 2) {