mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-06 03:08:02 -05:00
Implement CAPA pop3 command
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@131 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
75fe578336
commit
038637443b
@ -35,6 +35,13 @@ public class PopConnection extends AbstractConnection {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void printCapabilities() throws IOException {
|
||||
sendClient("TOP");
|
||||
sendClient("USER");
|
||||
sendClient("UIDL");
|
||||
sendClient(".");
|
||||
}
|
||||
|
||||
public void printList() throws IOException {
|
||||
int i = 1;
|
||||
for (ExchangeSession.Message message : messages) {
|
||||
@ -119,18 +126,32 @@ public class PopConnection extends AbstractConnection {
|
||||
}
|
||||
}
|
||||
} else if ("CAPA".equalsIgnoreCase(command)) {
|
||||
sendERR("unknown command");
|
||||
sendOK("Capability list follows");
|
||||
printCapabilities();
|
||||
} else if (state != AUTHENTICATED) {
|
||||
sendERR("invalid state not authenticated");
|
||||
sendERR("Invalid state not authenticated");
|
||||
} else {
|
||||
if ("STAT".equalsIgnoreCase(command)) {
|
||||
sendOK(messages.size() + " " +
|
||||
getTotalMessagesLength());
|
||||
} else if ("LIST".equalsIgnoreCase(command)) {
|
||||
sendOK(messages.size() +
|
||||
" messages (" + getTotalMessagesLength() +
|
||||
" octets)");
|
||||
printList();
|
||||
if (tokens.hasMoreTokens()) {
|
||||
String token = tokens.nextToken();
|
||||
try {
|
||||
int messageNumber = Integer.valueOf(token);
|
||||
ExchangeSession.Message message = messages.get(messageNumber-1);
|
||||
sendOK(""+messageNumber+" "+message.size);
|
||||
} catch (NumberFormatException e) {
|
||||
sendERR("Invalid message index: "+token);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
sendERR("Invalid message index: "+token);
|
||||
}
|
||||
} else {
|
||||
sendOK(messages.size() +
|
||||
" messages (" + getTotalMessagesLength() +
|
||||
" octets)");
|
||||
printList();
|
||||
}
|
||||
} else if ("UIDL".equalsIgnoreCase(command)) {
|
||||
sendOK(messages.size() +
|
||||
" messages (" + getTotalMessagesLength() +
|
||||
|
Loading…
Reference in New Issue
Block a user