Commit 8796d74f authored by Mickaël Guessant's avatar Mickaël Guessant

IMAP: merge patch from #634, copy mail doesn't preserve tag/category

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2447 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent 39006fdd
......@@ -1593,6 +1593,20 @@ public abstract class ExchangeSession {
return value;
}
/**
* Convert IMAP flags to keyword value.
*
* @param flags IMAP flags
* @return keyword value
*/
public String convertFlagsToKeywords(HashSet<String> flags) {
HashSet<String> keywordSet = new HashSet<String>();
for (String flag : flags) {
keywordSet.add(convertFlagToKeyword(flag));
}
return StringUtil.join(keywordSet, ",");
}
/**
* Exchange folder with IMAP properties
*/
......@@ -2199,11 +2213,7 @@ public abstract class ExchangeSession {
}
public String setFlags(HashSet<String> flags) {
HashSet<String> keywordSet = new HashSet<String>();
for (String flag : flags) {
keywordSet.add(convertFlagToKeyword(flag));
}
keywords = StringUtil.join(keywordSet, ",");
keywords = convertFlagsToKeywords(flags);
return keywords;
}
......
......@@ -455,6 +455,7 @@ public class ImapConnection extends AbstractConnection {
}
if (flags != null) {
HashSet<String> keywords = null;
// parse flags, on create read and draft flags are on the
// same messageFlags property, 8 means draft and 1 means read
ImapTokenizer flagtokenizer = new ImapTokenizer(flags);
......@@ -484,8 +485,16 @@ public class ImapConnection extends AbstractConnection {
}
} else if ("Junk".equalsIgnoreCase(flag)) {
properties.put("junk", "1");
} else {
if (keywords == null) {
keywords = new HashSet<String>();
}
keywords.add(flag);
}
}
if (keywords != null) {
properties.put("keywords", session.convertFlagsToKeywords(keywords));
}
} else {
// no flags, force not draft and unread
properties.put("draft", "0");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment