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

IMAP: initial append implementation

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@303 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-01-23 10:50:46 +00:00
parent f2e19291ab
commit 98f4ea5e51

View File

@ -250,6 +250,17 @@ public class ImapConnection extends AbstractConnection {
}
}
}
} else if ("append".equalsIgnoreCase(command)) {
String folderName = BASE64MailboxDecoder.decode(removeQuotes(tokens.nextToken()));
String parameters = tokens.nextToken();
int size = Integer.parseInt(removeQuotes(tokens.nextToken()));
sendClient("+ send literal data");
char[] buffer = new char[size];
in.read(buffer);
// empty line
readClient();
session.createMessage(session.getFolderPath(folderName), "test", null, new String(buffer), true);
sendClient(commandId + " OK APPEND completed");
} else if ("noop".equalsIgnoreCase(command)) {
sendClient(commandId + " OK NOOP completed");
} else {
@ -309,10 +320,10 @@ public class ImapConnection extends AbstractConnection {
protected String removeQuotes(String value) {
String result = value;
if (result.startsWith("\"")) {
if (result.startsWith("\"") || result.startsWith("{")) {
result = result.substring(1);
}
if (result.endsWith("\"")) {
if (result.endsWith("\"") || result.endsWith("}")) {
result = result.substring(0, result.length() - 1);
}
return result;