1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

POP: Implement UIDL <messageNumber> command to return a single UIDL

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@293 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-01-17 14:22:55 +00:00
parent 0281f7bdeb
commit 10aac6c062

View File

@ -106,7 +106,7 @@ public class PopConnection extends AbstractConnection {
sendERR("invalid syntax");
} else {
// bug 2194492 : allow space in password
password = line.substring("PASS".length()+1);
password = line.substring("PASS".length() + 1);
try {
session = ExchangeSessionFactory.getInstance(userName, password);
messages = session.getAllMessages();
@ -148,15 +148,26 @@ public class PopConnection extends AbstractConnection {
printList();
}
} else if ("UIDL".equalsIgnoreCase(command)) {
if (tokens.hasMoreTokens()) {
String token = tokens.nextToken();
try {
int messageNumber = Integer.valueOf(token);
sendOK(messageNumber + " " + messages.get(messageNumber - 1).uid);
} catch (NumberFormatException e) {
sendERR("Invalid message index: " + token);
} catch (IndexOutOfBoundsException e) {
sendERR("Invalid message index: " + token);
}
} else {
sendOK(messages.size() +
" messages (" + getTotalMessagesLength() +
" octets)");
printUidList();
}
} else if ("RETR".equalsIgnoreCase(command)) {
if (tokens.hasMoreTokens()) {
try {
int messageNumber = Integer.valueOf(tokens.
nextToken()) - 1;
int messageNumber = Integer.valueOf(tokens.nextToken()) - 1;
sendOK("");
messages.get(messageNumber).write(os);
sendClient("");