mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 14:08:38 -05:00
Caldav: move to trash on processItem
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1399 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
36e868a97e
commit
eece3d6b85
@ -2247,8 +2247,7 @@ public abstract class ExchangeSession {
|
||||
*/
|
||||
public List<Event> getEventMessages(String folderPath) throws IOException {
|
||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||
and(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request"),
|
||||
or(isNull("processed"), isFalse("processed"))));
|
||||
and(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1869,12 +1869,14 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
@Override
|
||||
public void processItem(String folderPath, String itemName) throws IOException {
|
||||
String eventPath = URIUtil.encodePath(getFolderPath(folderPath) + '/' + convertItemNameToEML(itemName));
|
||||
// do not delete calendar messages, mark read and processed
|
||||
// mark read
|
||||
ArrayList<DavConstants> list = new ArrayList<DavConstants>();
|
||||
list.add(Field.createDavProperty("processed", "true"));
|
||||
//list.add(Field.createDavProperty("processed", "true"));
|
||||
list.add(Field.createDavProperty("read", "1"));
|
||||
PropPatchMethod patchMethod = new PropPatchMethod(eventPath, list);
|
||||
DavGatewayHttpClientFacade.executeMethod(httpClient, patchMethod);
|
||||
// move to trash
|
||||
moveToTrash(eventPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2295,9 +2297,13 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
|
||||
@Override
|
||||
protected void moveToTrash(ExchangeSession.Message message) throws IOException {
|
||||
moveToTrash(message.permanentUrl);
|
||||
}
|
||||
|
||||
protected void moveToTrash(String messageUrl) throws IOException {
|
||||
String destination = URIUtil.encodePath(deleteditemsUrl) + '/' + UUID.randomUUID().toString();
|
||||
LOGGER.debug("Deleting : " + message.permanentUrl + " to " + destination);
|
||||
MoveMethod method = new MoveMethod(message.permanentUrl, destination, false);
|
||||
LOGGER.debug("Deleting : " + messageUrl + " to " + destination);
|
||||
MoveMethod method = new MoveMethod(messageUrl, destination, false);
|
||||
method.addRequestHeader("Allow-rename", "t");
|
||||
|
||||
int status = DavGatewayHttpClientFacade.executeHttpMethod(httpClient, method);
|
||||
|
Loading…
Reference in New Issue
Block a user