1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Needed for r326 Issue 91

This commit is contained in:
Daniel Applebaum 2009-01-24 18:54:47 +00:00
parent e1da49109f
commit b6e9910e00

View File

@ -998,9 +998,11 @@ public class ImapStore extends Store {
EOLConvertingOutputStream eolOut = new EOLConvertingOutputStream(out); EOLConvertingOutputStream eolOut = new EOLConvertingOutputStream(out);
message.writeTo(eolOut); message.writeTo(eolOut);
eolOut.flush(); eolOut.flush();
mConnection.sendCommand( mConnection.sendCommand(
String.format("APPEND \"%s\" {%d}", String.format("APPEND \"%s\" (%s) {%d}",
encodeFolderName(getPrefixedName()), encodeFolderName(getPrefixedName()),
combineFlags(message.getFlags()),
out.getCount()), false); out.getCount()), false);
ImapResponse response; ImapResponse response;
do { do {
@ -1028,6 +1030,8 @@ public class ImapStore extends Store {
{ {
message.setUid(newUid); message.setUid(newUid);
} }
} }
} }
catch (IOException ioe) { catch (IOException ioe) {
@ -1086,11 +1090,8 @@ public class ImapStore extends Store {
return null; return null;
} }
@Override private String combineFlags(Flag[] flags)
public void setFlags(Flag[] flags, boolean value) {
throws MessagingException {
checkOpen();
ArrayList<String> flagNames = new ArrayList<String>(); ArrayList<String> flagNames = new ArrayList<String>();
for (int i = 0, count = flags.length; i < count; i++) { for (int i = 0, count = flags.length; i < count; i++) {
Flag flag = flags[i]; Flag flag = flags[i];
@ -1108,10 +1109,19 @@ public class ImapStore extends Store {
} }
} }
return Utility.combine(flagNames.toArray(new String[flagNames.size()]), ' ');
}
@Override
public void setFlags(Flag[] flags, boolean value)
throws MessagingException {
checkOpen();
try { try {
mConnection.executeSimpleCommand(String.format("UID STORE 1:* %sFLAGS.SILENT (%s)", mConnection.executeSimpleCommand(String.format("UID STORE 1:* %sFLAGS.SILENT (%s)",
value ? "+" : "-", value ? "+" : "-", combineFlags(flags) ));
Utility.combine(flagNames.toArray(new String[flagNames.size()]), ' ')));
} }
catch (IOException ioe) { catch (IOException ioe) {
throw ioExceptionHandler(mConnection, ioe); throw ioExceptionHandler(mConnection, ioe);