mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 11:48: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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printCapabilities() throws IOException {
|
||||||
|
sendClient("TOP");
|
||||||
|
sendClient("USER");
|
||||||
|
sendClient("UIDL");
|
||||||
|
sendClient(".");
|
||||||
|
}
|
||||||
|
|
||||||
public void printList() throws IOException {
|
public void printList() throws IOException {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (ExchangeSession.Message message : messages) {
|
for (ExchangeSession.Message message : messages) {
|
||||||
@ -119,18 +126,32 @@ public class PopConnection extends AbstractConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("CAPA".equalsIgnoreCase(command)) {
|
} else if ("CAPA".equalsIgnoreCase(command)) {
|
||||||
sendERR("unknown command");
|
sendOK("Capability list follows");
|
||||||
|
printCapabilities();
|
||||||
} else if (state != AUTHENTICATED) {
|
} else if (state != AUTHENTICATED) {
|
||||||
sendERR("invalid state not authenticated");
|
sendERR("Invalid state not authenticated");
|
||||||
} else {
|
} else {
|
||||||
if ("STAT".equalsIgnoreCase(command)) {
|
if ("STAT".equalsIgnoreCase(command)) {
|
||||||
sendOK(messages.size() + " " +
|
sendOK(messages.size() + " " +
|
||||||
getTotalMessagesLength());
|
getTotalMessagesLength());
|
||||||
} else if ("LIST".equalsIgnoreCase(command)) {
|
} else if ("LIST".equalsIgnoreCase(command)) {
|
||||||
sendOK(messages.size() +
|
if (tokens.hasMoreTokens()) {
|
||||||
" messages (" + getTotalMessagesLength() +
|
String token = tokens.nextToken();
|
||||||
" octets)");
|
try {
|
||||||
printList();
|
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)) {
|
} else if ("UIDL".equalsIgnoreCase(command)) {
|
||||||
sendOK(messages.size() +
|
sendOK(messages.size() +
|
||||||
" messages (" + getTotalMessagesLength() +
|
" messages (" + getTotalMessagesLength() +
|
||||||
|
Loading…
Reference in New Issue
Block a user