1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-01-08 12:18:07 -05:00

IMAP: send back flags on STORE command

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@312 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-02 20:46:15 +00:00
parent 81f88a5d18
commit 8ec93490fb

View File

@ -150,11 +150,10 @@ public class ImapConnection extends AbstractConnection {
sendClient("* " + currentFolder.objectCount + " RECENT"); sendClient("* " + currentFolder.objectCount + " RECENT");
sendClient("* OK [UIDVALIDITY 1]"); sendClient("* OK [UIDVALIDITY 1]");
if (messages.size() == 0) { if (messages.size() == 0) {
sendClient("* OK [UIDNEXT " + 1 + "]"); sendClient("* OK [UIDNEXT " + 1 + "]");
} else { } else {
sendClient("* OK [UIDNEXT " + (messages.get(messages.size()-1).getUidAsLong()+1) + "]"); sendClient("* OK [UIDNEXT " + (messages.get(messages.size() - 1).getUidAsLong() + 1) + "]");
} }
//sendClient("* OK [UIDNEXT " + (currentFolder.objectCount + 1) + "]");
sendClient("* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded $MDNSent Forwarded $Junk $NotJunk Junk JunkRecorded NonJunk NotJunk)"); sendClient("* FLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded $MDNSent Forwarded $Junk $NotJunk Junk JunkRecorded NonJunk NotJunk)");
sendClient("* OK [PERMANENTFLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded $MDNSent Forwarded \\*)] junk-related flags are not permanent"); sendClient("* OK [PERMANENTFLAGS (\\Answered \\Deleted \\Draft \\Flagged \\Seen $Forwarded $MDNSent Forwarded \\*)] junk-related flags are not permanent");
//sendClient("* [UNSEEN 1] first unseen message in inbox"); //sendClient("* [UNSEEN 1] first unseen message in inbox");
@ -209,9 +208,9 @@ public class ImapConnection extends AbstractConnection {
if (messages.size() > 0) { if (messages.size() > 0) {
endIndex = messages.get(messages.size() - 1).getUidAsLong(); endIndex = messages.get(messages.size() - 1).getUidAsLong();
// fix according to spec // fix according to spec
if (startIndex > endIndex) { //if (startIndex > endIndex) {
startIndex = endIndex; // startIndex = endIndex;
} //}
} else { } else {
endIndex = 1; endIndex = 1;
} }
@ -288,6 +287,7 @@ public class ImapConnection extends AbstractConnection {
} else if ("store".equalsIgnoreCase(subcommand)) { } else if ("store".equalsIgnoreCase(subcommand)) {
long uid = Long.parseLong(tokens.nextToken()); long uid = Long.parseLong(tokens.nextToken());
ExchangeSession.Message message = messages.getByUid(uid);
String action = tokens.nextToken(); String action = tokens.nextToken();
String flags = tokens.nextToken(); String flags = tokens.nextToken();
HashMap<String, String> properties = new HashMap<String, String>(); HashMap<String, String> properties = new HashMap<String, String>();
@ -297,6 +297,7 @@ public class ImapConnection extends AbstractConnection {
String flag = flagtokenizer.nextToken(); String flag = flagtokenizer.nextToken();
if ("\\Seen".equals(flag)) { if ("\\Seen".equals(flag)) {
properties.put("read", "0"); properties.put("read", "0");
message.read = false;
} }
} }
} else if ("+Flags".equalsIgnoreCase(action)) { } else if ("+Flags".equalsIgnoreCase(action)) {
@ -305,11 +306,18 @@ public class ImapConnection extends AbstractConnection {
String flag = flagtokenizer.nextToken(); String flag = flagtokenizer.nextToken();
if ("\\Seen".equals(flag)) { if ("\\Seen".equals(flag)) {
properties.put("read", "1"); properties.put("read", "1");
message.read = true;
} }
} }
} }
// TODO
session.updateMessage(messages.getByUid(uid), properties); session.updateMessage(messages.getByUid(uid), properties);
int index = 0;
for (ExchangeSession.Message currentMessage : messages) {
index++;
if (currentMessage == message) {
sendClient("* " + index + " FETCH (UID " + message.getUidAsLong() + " FLAGS (" + (message.read ? "\\Seen" : "") + "))");
}
}
sendClient(commandId + " OK STORE completed"); sendClient(commandId + " OK STORE completed");
} }
} else { } else {