mirror of
https://github.com/moparisthebest/davmail
synced 2024-10-31 15:35:05 -04:00
IMAP: implement generic FLAGS mapping to Outlook categories
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2023 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
59f752acf4
commit
9475873dd9
@ -1929,7 +1929,13 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
if (buffer.length() > 0) {
|
||||
buffer.append(',');
|
||||
}
|
||||
if (node instanceof Node) {
|
||||
// jackrabbit
|
||||
buffer.append(((Node) node).getTextContent());
|
||||
} else {
|
||||
// ExchangeDavMethod
|
||||
buffer.append(node);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
} else {
|
||||
@ -2488,6 +2494,8 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
list.add(Field.createDavProperty("deleted", entry.getValue()));
|
||||
} else if ("datereceived".equals(entry.getKey())) {
|
||||
list.add(Field.createDavProperty("datereceived", entry.getValue()));
|
||||
} else if ("keywords".equals(entry.getKey())) {
|
||||
list.add(Field.createDavProperty("keywords", entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +428,8 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
list.add(Field.createFieldUpdate("deleted", entry.getValue()));
|
||||
} else if ("datereceived".equals(entry.getKey())) {
|
||||
list.add(Field.createFieldUpdate("datereceived", entry.getValue()));
|
||||
} else if ("keywords".equals(entry.getKey())) {
|
||||
list.add(Field.createFieldUpdate("keywords", entry.getValue()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -128,7 +128,7 @@ public class ExtendedFieldURI implements FieldURI {
|
||||
appendTo(buffer);
|
||||
if (propertyType == PropertyType.StringArray) {
|
||||
buffer.append("<t:Values>");
|
||||
String[] values = value.split("\n");
|
||||
String[] values = value.split(",");
|
||||
for (final String singleValue : values) {
|
||||
buffer.append("<t:Value>");
|
||||
buffer.append(StringUtil.xmlEncode(singleValue));
|
||||
|
@ -228,7 +228,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
sendClient("* OK [UIDNEXT " + currentFolder.getUidNext() + ']');
|
||||
}
|
||||
sendClient("* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded Junk)");
|
||||
sendClient("* OK [PERMANENTFLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded Junk)]");
|
||||
sendClient("* OK [PERMANENTFLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded Junk \\*)]");
|
||||
if ("select".equalsIgnoreCase(command)) {
|
||||
sendClient(commandId + " OK [READ-WRITE] " + command + " completed");
|
||||
} else {
|
||||
@ -1408,6 +1408,16 @@ public class ImapConnection extends AbstractConnection {
|
||||
} else if ("\\Answered".equalsIgnoreCase(flag) && message.answered) {
|
||||
properties.put("answered", null);
|
||||
message.answered = false;
|
||||
} else if (message.keywords != null) {
|
||||
String[] keywords = message.keywords.split(",");
|
||||
HashSet<String> keywordSet = new HashSet<String>();
|
||||
for (String value : keywords) {
|
||||
if (!value.equals(flag)) {
|
||||
keywordSet.add(value);
|
||||
}
|
||||
}
|
||||
message.keywords = StringUtil.join(keywordSet, ",");
|
||||
properties.put("keywords", message.keywords);
|
||||
}
|
||||
}
|
||||
} else if ("+Flags".equalsIgnoreCase(action) || "+FLAGS.SILENT".equalsIgnoreCase(action)) {
|
||||
@ -1432,6 +1442,17 @@ public class ImapConnection extends AbstractConnection {
|
||||
} else if ("Junk".equalsIgnoreCase(flag) && !message.junk) {
|
||||
properties.put("junk", "1");
|
||||
message.junk = true;
|
||||
} else {
|
||||
HashSet<String> keywordSet = new HashSet<String>();
|
||||
if (message.keywords != null) {
|
||||
String[] keywords = message.keywords.split(",");
|
||||
for (String value : keywords) {
|
||||
keywordSet.add(value);
|
||||
}
|
||||
}
|
||||
keywordSet.add(flag);
|
||||
message.keywords = StringUtil.join(keywordSet, ",");
|
||||
properties.put("keywords", message.keywords);
|
||||
}
|
||||
}
|
||||
} else if ("FLAGS".equalsIgnoreCase(action) || "FLAGS.SILENT".equalsIgnoreCase(action)) {
|
||||
@ -1442,6 +1463,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
boolean flagged = false;
|
||||
boolean answered = false;
|
||||
boolean forwarded = false;
|
||||
HashSet<String> keywords = null;
|
||||
// set flags from new flag list
|
||||
StringTokenizer flagtokenizer = new StringTokenizer(flags);
|
||||
while (flagtokenizer.hasMoreTokens()) {
|
||||
@ -1458,7 +1480,16 @@ public class ImapConnection extends AbstractConnection {
|
||||
forwarded = true;
|
||||
} else if ("Junk".equalsIgnoreCase(flag)) {
|
||||
junk = true;
|
||||
} else {
|
||||
if (keywords == null) {
|
||||
keywords = new HashSet<String>();
|
||||
}
|
||||
keywords.add(flag);
|
||||
}
|
||||
}
|
||||
if (keywords != null) {
|
||||
message.keywords = StringUtil.join(keywords, ",");
|
||||
properties.put("keywords", message.keywords);
|
||||
}
|
||||
if (read != message.read) {
|
||||
message.read = read;
|
||||
|
Loading…
Reference in New Issue
Block a user