1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-01-12 22:18:11 -05:00

Caldav: fix regression in processItem

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1239 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-20 21:00:49 +00:00
parent 68bfabc393
commit 03927f53dc
5 changed files with 12 additions and 6 deletions

View File

@ -1289,7 +1289,7 @@ public class DavExchangeSession extends ExchangeSession {
String eventPath = URIUtil.encodePath(getFolderPath(folderPath) + '/' + convertItemNameToEML(itemName));
// do not delete calendar messages, mark read and processed
ArrayList<DavConstants> list = new ArrayList<DavConstants>();
list.add(Field.createDavProperty("processed", "1"));
list.add(Field.createDavProperty("processed", "true"));
list.add(Field.createDavProperty("read", "1"));
PropPatchMethod patchMethod = new PropPatchMethod(eventPath, list);
DavGatewayHttpClientFacade.executeMethod(httpClient, patchMethod);
@ -1490,7 +1490,7 @@ public class DavExchangeSession extends ExchangeSession {
*/
@Override
public void createMessage(String folderPath, String messageName, HashMap<String, String> properties, byte[] messageBody) throws IOException {
String messageUrl = URIUtil.encodePathQuery(getFolderPath(folderPath) + '/' + messageName + ".EML");
String messageUrl = URIUtil.encodePathQuery(getFolderPath(folderPath) + '/' + messageName);
PropPatchMethod patchMethod;
List<DavConstants> davProperties = buildProperties(properties);
if (properties != null) {
@ -1579,7 +1579,7 @@ public class DavExchangeSession extends ExchangeSession {
*/
@Override
public void sendMessage(byte[] messageBody) throws IOException {
String messageName = UUID.randomUUID().toString();
String messageName = UUID.randomUUID().toString()+".EML";
createMessage("Drafts", messageName, null, messageBody);

View File

@ -176,6 +176,7 @@ public class EwsExchangeSession extends ExchangeSession {
fieldUpdates.add(Field.createFieldUpdate("messageFlags", "0"));
}
}
fieldUpdates.add(Field.createFieldUpdate("urlcompname", messageName));
item.setFieldUpdates(fieldUpdates);
CreateItemMethod createItemMethod = new CreateItemMethod(MessageDisposition.SaveOnly, getFolderId(folderPath), item);
executeMethod(createItemMethod);

View File

@ -423,7 +423,7 @@ public class ImapConnection extends AbstractConnection {
// empty line
readClient();
String messageName = UUID.randomUUID().toString();
String messageName = UUID.randomUUID().toString() + ".EML";
session.createMessage(folderName, messageName, properties, buffer);
sendClient(commandId + " OK APPEND completed");
} else if ("idle".equalsIgnoreCase(command) && imapIdleDelay > 0) {

View File

@ -30,12 +30,13 @@ import java.util.UUID;
*/
public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase {
static ExchangeSession.Message message;
static String messageName;
public void testCreateMessage() throws IOException, MessagingException {
session.deleteFolder("testfolder");
session.createMessageFolder("testfolder");
MimeMessage mimeMessage = createMimeMessage();
String messageName = UUID.randomUUID().toString();
messageName = UUID.randomUUID().toString()+".EML";
HashMap<String, String> properties = new HashMap<String, String>();
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));
}
@ -78,6 +79,10 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase
assertEquals("Test message", mimeMessage.getContent());
}
public void testProcessMessage() throws IOException, MessagingException {
session.processItem("testfolder", messageName);
}
public void testDeleteMessage() throws IOException {
session.deleteMessage(message);
ExchangeSession.MessageList messageList = session.searchMessages("testfolder");

View File

@ -44,7 +44,7 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest
public void testCreateDraftMessage() throws MessagingException, IOException {
MimeMessage mimeMessage = createMimeMessage();
String messageName = UUID.randomUUID().toString();
String messageName = UUID.randomUUID().toString()+".EML";
HashMap<String, String> properties = new HashMap<String, String>();
properties.put("draft", "9");
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));