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:
mguessan 2009-07-28 06:53:46 +00:00
parent 3e06e834b4
commit 4c5c2ee81d
2 changed files with 13 additions and 13 deletions

View File

@ -535,14 +535,14 @@ public class ExchangeSession {
* Create message in specified 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 properties message properties (flags)
* @param messageBody mail body
* @throws IOException when unable to create message
*/
public void createMessage(String folderUrl, String messageName, HashMap<String, String> properties, String messageBody) throws IOException {
String messageUrl = URIUtil.encodePathQuery(folderUrl + '/' + messageName + ".EML");
public void createMessage(String folderPath, String messageName, HashMap<String, String> properties, String messageBody) throws IOException {
String messageUrl = URIUtil.encodePathQuery(getFolderPath(folderPath) + '/' + messageName + ".EML");
PropPatchMethod patchMethod;
// create the message first as draft
if (properties.containsKey("draft")) {
@ -884,7 +884,7 @@ public class ExchangeSession {
String messageName = UUID.randomUUID().toString();
createMessage(draftsUrl, messageName, properties, mailBuffer.toString());
createMessage("Drafts", messageName, properties, mailBuffer.toString());
String tempUrl = draftsUrl + '/' + messageName + ".EML";
MoveMethod method = new MoveMethod(URIUtil.encodePath(tempUrl), URIUtil.encodePath(sendmsgUrl), true);
@ -895,9 +895,9 @@ public class ExchangeSession {
}
/**
*
* @param folderName
* @return
* Convert logical or relative folder path to absolute folder path.
* @param folderName folder name
* @return folder path
*/
public String getFolderPath(String folderName) {
String folderPath;
@ -921,13 +921,13 @@ public class ExchangeSession {
}
/**
* Select current folder.
* Folder name can be logical names INBOX, DRAFTS or TRASH (translated to local names),
* relative path to user base folder or absolute path.
* Get folder object.
* Folder name can be logical names INBOX, Drafts, Trash or calendar,
* or a path relative to user base folder or absolute path.
*
* @param folderName folder name
* @return Folder object
* @throws IOException when unable to change folder
* @throws IOException on error
*/
public Folder getFolder(String folderName) throws IOException {
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
* @return current folder or new refreshed folder

View File

@ -383,7 +383,7 @@ public class ImapConnection extends AbstractConnection {
readClient();
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");
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
if (currentFolder != null) {