Set/Unset the given flags in this message.
(Flags flag, boolean set)
| 1110 | * Set/Unset the given flags in this message. |
| 1111 | */ |
| 1112 | @Override |
| 1113 | public synchronized void setFlags(Flags flag, boolean set) |
| 1114 | throws MessagingException { |
| 1115 | // Acquire MessageCacheLock, to freeze seqnum. |
| 1116 | synchronized(getMessageCacheLock()) { |
| 1117 | try { |
| 1118 | IMAPProtocol p = getProtocol(); |
| 1119 | checkExpunged(); // Insure that this message is not expunged |
| 1120 | if (p.hasCapability("X-UIDONLY") || |
| 1121 | "imap.mail.yahoo.co.jp".equals(p.getInetAddress().getHostName()) || |
| 1122 | (p.hasCapability("UIDPLUS") && |
| 1123 | Boolean.parseBoolean(System.getProperty("fairemail.uid_command")))) { |
| 1124 | // Verizon |
| 1125 | // Yahoo: NO [CANNOT] STORE It's not possible to perform specified operation |
| 1126 | long uid = getUID(); |
| 1127 | if (uid < 0) { |
| 1128 | UID u = p.fetchUID(getSequenceNumber()); |
| 1129 | if (u != null) |
| 1130 | uid = u.uid; |
| 1131 | } |
| 1132 | Response[] r = p.command("UID STORE " + uid + |
| 1133 | " " + (set ? '+' : '-') + "FLAGS " + p.createFlagList(new Flags(flag)), null); |
| 1134 | p.notifyResponseHandlers(r); |
| 1135 | p.handleResult(r[r.length - 1]); |
| 1136 | return; |
| 1137 | } |
| 1138 | p.storeFlags(getSequenceNumber(), flag, set); |
| 1139 | } catch (ConnectionException cex) { |
| 1140 | throw new FolderClosedException(folder, cex.getMessage()); |
| 1141 | } catch (ProtocolException pex) { |
| 1142 | throw new MessagingException(pex.getMessage(), pex); |
| 1143 | } |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | /** |
| 1148 | * Set whether or not to use the PEEK variant of FETCH when |
nothing calls this directly
no test coverage detected