MCPcopy Create free account
hub / github.com/M66B/FairEmail / setFlags

Method setFlags

app/src/main/java/eu/faircode/email/IMAPFolderEx.java:55–94  ·  view source on GitHub ↗
(Message[] msgs, Flags flag, boolean value)

Source from the content-addressed store, hash-verified

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 {

Callers 5

onSetFlagMethod · 0.45
onDeleteMethod · 0.45
onReportMethod · 0.45
onPurgeFolderMethod · 0.45
SuggestionSpanExMethod · 0.45

Calls 15

hasCapabilityMethod · 0.95
addMethod · 0.95
toUIDSetMethod · 0.95
toStringMethod · 0.95
createFlagListMethod · 0.95
toMessageSetSortedMethod · 0.95
storeFlagsMethod · 0.95
checkOpenedMethod · 0.80
commandMethod · 0.80
handleResultMethod · 0.80
getMessageMethod · 0.65

Tested by

no test coverage detected