Make API more consistent: createMessage must get a folder path, not URL
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@636 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
3e06e834b4
commit
4c5c2ee81d
|
@ -535,14 +535,14 @@ public class ExchangeSession {
|
||||||
* Create message in specified folder.
|
* Create message in specified folder.
|
||||||
* Will overwrite an existing message with same subject in the same folder
|
* Will overwrite an existing message with same subject in the same folder
|
||||||
*
|
*
|
||||||
* @param folderUrl Exchange folder URL
|
* @param folderPath Exchange folder path
|
||||||
* @param messageName message name
|
* @param messageName message name
|
||||||
* @param properties message properties (flags)
|
* @param properties message properties (flags)
|
||||||
* @param messageBody mail body
|
* @param messageBody mail body
|
||||||
* @throws IOException when unable to create message
|
* @throws IOException when unable to create message
|
||||||
*/
|
*/
|
||||||
public void createMessage(String folderUrl, String messageName, HashMap<String, String> properties, String messageBody) throws IOException {
|
public void createMessage(String folderPath, String messageName, HashMap<String, String> properties, String messageBody) throws IOException {
|
||||||
String messageUrl = URIUtil.encodePathQuery(folderUrl + '/' + messageName + ".EML");
|
String messageUrl = URIUtil.encodePathQuery(getFolderPath(folderPath) + '/' + messageName + ".EML");
|
||||||
PropPatchMethod patchMethod;
|
PropPatchMethod patchMethod;
|
||||||
// create the message first as draft
|
// create the message first as draft
|
||||||
if (properties.containsKey("draft")) {
|
if (properties.containsKey("draft")) {
|
||||||
|
@ -884,7 +884,7 @@ public class ExchangeSession {
|
||||||
|
|
||||||
String messageName = UUID.randomUUID().toString();
|
String messageName = UUID.randomUUID().toString();
|
||||||
|
|
||||||
createMessage(draftsUrl, messageName, properties, mailBuffer.toString());
|
createMessage("Drafts", messageName, properties, mailBuffer.toString());
|
||||||
|
|
||||||
String tempUrl = draftsUrl + '/' + messageName + ".EML";
|
String tempUrl = draftsUrl + '/' + messageName + ".EML";
|
||||||
MoveMethod method = new MoveMethod(URIUtil.encodePath(tempUrl), URIUtil.encodePath(sendmsgUrl), true);
|
MoveMethod method = new MoveMethod(URIUtil.encodePath(tempUrl), URIUtil.encodePath(sendmsgUrl), true);
|
||||||
|
@ -895,9 +895,9 @@ public class ExchangeSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Convert logical or relative folder path to absolute folder path.
|
||||||
* @param folderName
|
* @param folderName folder name
|
||||||
* @return
|
* @return folder path
|
||||||
*/
|
*/
|
||||||
public String getFolderPath(String folderName) {
|
public String getFolderPath(String folderName) {
|
||||||
String folderPath;
|
String folderPath;
|
||||||
|
@ -921,13 +921,13 @@ public class ExchangeSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select current folder.
|
* Get folder object.
|
||||||
* Folder name can be logical names INBOX, DRAFTS or TRASH (translated to local names),
|
* Folder name can be logical names INBOX, Drafts, Trash or calendar,
|
||||||
* relative path to user base folder or absolute path.
|
* or a path relative to user base folder or absolute path.
|
||||||
*
|
*
|
||||||
* @param folderName folder name
|
* @param folderName folder name
|
||||||
* @return Folder object
|
* @return Folder object
|
||||||
* @throws IOException when unable to change folder
|
* @throws IOException on error
|
||||||
*/
|
*/
|
||||||
public Folder getFolder(String folderName) throws IOException {
|
public Folder getFolder(String folderName) throws IOException {
|
||||||
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
MultiStatusResponse[] responses = DavGatewayHttpClientFacade.executePropFindMethod(
|
||||||
|
@ -941,7 +941,7 @@ public class ExchangeSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check folder ctag and reload messages as needed
|
* Check folder ctag and reload messages as needed.
|
||||||
*
|
*
|
||||||
* @param currentFolder current folder
|
* @param currentFolder current folder
|
||||||
* @return current folder or new refreshed folder
|
* @return current folder or new refreshed folder
|
||||||
|
|
|
@ -383,7 +383,7 @@ public class ImapConnection extends AbstractConnection {
|
||||||
readClient();
|
readClient();
|
||||||
|
|
||||||
String messageName = UUID.randomUUID().toString();
|
String messageName = UUID.randomUUID().toString();
|
||||||
session.createMessage(session.getFolderPath(folderName), messageName, properties, new String(buffer));
|
session.createMessage(folderName, messageName, properties, new String(buffer));
|
||||||
sendClient(commandId + " OK APPEND completed");
|
sendClient(commandId + " OK APPEND completed");
|
||||||
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
|
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
|
||||||
if (currentFolder != null) {
|
if (currentFolder != null) {
|
||||||
|
|
Loading…
Reference in New Issue