mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 22:18:11 -05:00
IMAP: implement STORE FLAGS and allow empty date
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@396 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
cb441d22ef
commit
6cc5e2ec6f
@ -435,7 +435,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
buffer.append(" FLAGS (").append(message.getImapFlags()).append(")");
|
||||
} else if ("BODYSTRUCTURE".equals(param)) {
|
||||
buffer.append(" BODYSTRUCTURE (\"TEXT\" \"PLAIN\" (\"CHARSET\" \"windows-1252\") NIL NIL \"QUOTED-PRINTABLE\" ").append(message.size).append(" 50 NIL NIL NIL NIL))");
|
||||
} else if ("INTERNALDATE".equals(param)) {
|
||||
} else if ("INTERNALDATE".equals(param) && message.date != null && message.date.length() > 0) {
|
||||
try {
|
||||
SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
dateParser.setTimeZone(ExchangeSession.GMT_TIMEZONE);
|
||||
@ -643,6 +643,36 @@ public class ImapConnection extends AbstractConnection {
|
||||
message.junk = true;
|
||||
}
|
||||
}
|
||||
} else if ("FLAGS".equalsIgnoreCase(action)) {
|
||||
properties.put("read", "0");
|
||||
message.read = false;
|
||||
properties.put("flagged", "0");
|
||||
message.flagged = false;
|
||||
properties.put("junk", "0");
|
||||
message.junk = false;
|
||||
StringTokenizer flagtokenizer = new StringTokenizer(flags);
|
||||
while (flagtokenizer.hasMoreTokens()) {
|
||||
String flag = flagtokenizer.nextToken();
|
||||
if ("\\Seen".equals(flag)) {
|
||||
properties.put("read", "1");
|
||||
message.read = true;
|
||||
} else if ("\\Deleted".equals(flag)) {
|
||||
message.deleted = true;
|
||||
properties.put("deleted", "1");
|
||||
} else if ("\\Flagged".equals(flag)) {
|
||||
properties.put("flagged", "2");
|
||||
message.flagged = true;
|
||||
} else if ("\\Answered".equals(flag)) {
|
||||
properties.put("answered", "102");
|
||||
message.answered = true;
|
||||
} else if ("$Forwarded".equals(flag)) {
|
||||
properties.put("forwarded", "104");
|
||||
message.forwarded = true;
|
||||
} else if ("Junk".equals(flag)) {
|
||||
properties.put("junk", "1");
|
||||
message.junk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (properties.size() > 0) {
|
||||
session.updateMessage(message, properties);
|
||||
|
Loading…
Reference in New Issue
Block a user