(Message[] msgs, Flags flag, boolean value)
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public synchronized void setFlags(Message[] msgs, Flags flag, boolean value) throws MessagingException { |
| 57 | checkOpened(); |
| 58 | // checkFlags(flag); |
| 59 | |
| 60 | if (msgs.length == 0) |
| 61 | return; |
| 62 | |
| 63 | synchronized (messageCacheLock) { |
| 64 | try { |
| 65 | IMAPProtocol p = getProtocol(); |
| 66 | if (p.hasCapability("X-UIDONLY") || |
| 67 | (p.hasCapability("UIDPLUS") && |
| 68 | Boolean.parseBoolean(System.getProperty("fairemail.uid_command")))) { |
| 69 | // Verizon |
| 70 | FetchProfile fp = new FetchProfile(); |
| 71 | fp.add(UIDFolder.FetchProfileItem.UID); |
| 72 | fetch(msgs, fp); |
| 73 | |
| 74 | UIDSet[] uids = Utility.toUIDSet(msgs); |
| 75 | if (uids == null) |
| 76 | return; |
| 77 | |
| 78 | Response[] r = p.command("UID STORE " + UIDSet.toString(uids) + |
| 79 | " " + (value ? '+' : '-') + "FLAGS " + p.createFlagList(new Flags(flag)), null); |
| 80 | p.notifyResponseHandlers(r); |
| 81 | p.handleResult(r[r.length - 1]); |
| 82 | return; |
| 83 | } |
| 84 | MessageSet[] ms = Utility.toMessageSetSorted(msgs, null); |
| 85 | if (ms == null) |
| 86 | throw new MessageRemovedException("Messages have been removed"); |
| 87 | p.storeFlags(ms, flag, value); |
| 88 | } catch (ConnectionException cex) { |
| 89 | throw new FolderClosedException(this, cex.getMessage()); |
| 90 | } catch (ProtocolException pex) { |
| 91 | throw new MessagingException(pex.getMessage(), pex); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public synchronized void copyMessages(Message[] msgs, Folder folder) throws MessagingException { |
no test coverage detected