mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Needed for r326 Issue 91
This commit is contained in:
parent
e1da49109f
commit
b6e9910e00
@ -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,32 +1090,38 @@ public class ImapStore extends Store {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String combineFlags(Flag[] flags)
|
||||||
|
{
|
||||||
|
ArrayList<String> flagNames = new ArrayList<String>();
|
||||||
|
for (int i = 0, count = flags.length; i < count; i++) {
|
||||||
|
Flag flag = flags[i];
|
||||||
|
if (flag == Flag.SEEN) {
|
||||||
|
flagNames.add("\\Seen");
|
||||||
|
}
|
||||||
|
else if (flag == Flag.DELETED) {
|
||||||
|
flagNames.add("\\Deleted");
|
||||||
|
}
|
||||||
|
else if (flag == Flag.ANSWERED) {
|
||||||
|
flagNames.add("\\Answered");
|
||||||
|
}
|
||||||
|
else if (flag == Flag.FLAGGED) {
|
||||||
|
flagNames.add("\\Flagged");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return Utility.combine(flagNames.toArray(new String[flagNames.size()]), ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(Flag[] flags, boolean value)
|
public void setFlags(Flag[] flags, boolean value)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
|
|
||||||
ArrayList<String> flagNames = new ArrayList<String>();
|
|
||||||
for (int i = 0, count = flags.length; i < count; i++) {
|
|
||||||
Flag flag = flags[i];
|
|
||||||
if (flag == Flag.SEEN) {
|
|
||||||
flagNames.add("\\Seen");
|
|
||||||
}
|
|
||||||
else if (flag == Flag.DELETED) {
|
|
||||||
flagNames.add("\\Deleted");
|
|
||||||
}
|
|
||||||
else if (flag == Flag.ANSWERED) {
|
|
||||||
flagNames.add("\\Answered");
|
|
||||||
}
|
|
||||||
else if (flag == Flag.FLAGGED) {
|
|
||||||
flagNames.add("\\Flagged");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user