1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12: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

@ -148,15 +148,26 @@ public class PopConnection extends AbstractConnection {
printList(); printList();
} }
} else if ("UIDL".equalsIgnoreCase(command)) { } 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() + sendOK(messages.size() +
" messages (" + getTotalMessagesLength() + " messages (" + getTotalMessagesLength() +
" octets)"); " octets)");
printUidList(); printUidList();
}
} else if ("RETR".equalsIgnoreCase(command)) { } else if ("RETR".equalsIgnoreCase(command)) {
if (tokens.hasMoreTokens()) { if (tokens.hasMoreTokens()) {
try { try {
int messageNumber = Integer.valueOf(tokens. int messageNumber = Integer.valueOf(tokens.nextToken()) - 1;
nextToken()) - 1;
sendOK(""); sendOK("");
messages.get(messageNumber).write(os); messages.get(messageNumber).write(os);
sendClient(""); sendClient("");