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

Method setLabels

app/src/main/java/com/sun/mail/gimap/GmailFolder.java:138–162  ·  view source on GitHub ↗

Set the specified labels for the given array of messages. @param msgs the messages @param labels the labels to add or remove @param set true to add, false to remove @exception MessagingException for failures @since JavaMail 1.5.5

(Message[] msgs,
				String[] labels, boolean set)

Source from the content-addressed store, hash-verified

136 * @since JavaMail 1.5.5
137 */
138 public synchronized void setLabels(Message[] msgs,
139 String[] labels, boolean set)
140 throws MessagingException {
141 checkOpened();
142
143 if (msgs.length == 0) // boundary condition
144 return;
145
146 synchronized(messageCacheLock) {
147 try {
148 IMAPProtocol ip = getProtocol();
149 assert ip instanceof GmailProtocol;
150 GmailProtocol p = (GmailProtocol)ip;
151 MessageSet[] ms = Utility.toMessageSetSorted(msgs, null);
152 if (ms == null)
153 throw new MessageRemovedException(
154 "Messages have been removed");
155 p.storeLabels(ms, labels, set);
156 } catch (ConnectionException cex) {
157 throw new FolderClosedException(this, cex.getMessage());
158 } catch (ProtocolException pex) {
159 throw new MessagingException(pex.getMessage(), pex);
160 }
161 }
162 }
163
164 /**
165 * Set the specified labels for the given range of message numbers.

Callers 1

onLabelMethod · 0.45

Calls 5

toMessageSetSortedMethod · 0.95
storeLabelsMethod · 0.95
checkOpenedMethod · 0.80
getMessageMethod · 0.65
getProtocolMethod · 0.45

Tested by

no test coverage detected