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

Method fetch

app/src/main/java/com/sun/mail/imap/IMAPFolder.java:1189–1348  ·  view source on GitHub ↗

Prefetch attributes, based on the given FetchProfile.

(Message[] msgs, FetchProfile fp)

Source from the content-addressed store, hash-verified

1187 * Prefetch attributes, based on the given FetchProfile.
1188 */
1189 @Override
1190 public synchronized void fetch(Message[] msgs, FetchProfile fp)
1191 throws MessagingException {
1192 // cache this information in case connection is closed and
1193 // protocol is set to null
1194 boolean isRev1;
1195 FetchItem[] fitems;
1196 synchronized (messageCacheLock) {
1197 checkOpened();
1198 isRev1 = protocol.isREV1();
1199 fitems = protocol.getFetchItems();
1200 }
1201
1202 StringBuilder command = new StringBuilder();
1203 boolean first = true;
1204 boolean allHeaders = false;
1205
1206 if (fp.contains(FetchProfile.Item.ENVELOPE)) {
1207 command.append(getEnvelopeCommand());
1208 first = false;
1209 }
1210 if (fp.contains(FetchProfile.Item.FLAGS)) {
1211 command.append(first ? "FLAGS" : " FLAGS");
1212 first = false;
1213 }
1214 if (fp.contains(FetchProfile.Item.CONTENT_INFO)) {
1215 command.append(first ? "BODYSTRUCTURE" : " BODYSTRUCTURE");
1216 first = false;
1217 }
1218 if (fp.contains(UIDFolder.FetchProfileItem.UID)) {
1219 command.append(first ? "UID" : " UID");
1220 first = false;
1221 }
1222 if (fp.contains(IMAPFolder.FetchProfileItem.HEADERS)) {
1223 allHeaders = true;
1224 if (isRev1)
1225 command.append(first ?
1226 "BODY.PEEK[HEADER]" : " BODY.PEEK[HEADER]");
1227 else
1228 command.append(first ? "RFC822.HEADER" : " RFC822.HEADER");
1229 first = false;
1230 }
1231 if (fp.contains(IMAPFolder.FetchProfileItem.MESSAGE)) {
1232 allHeaders = true;
1233 if (isRev1)
1234 command.append(first ? "BODY.PEEK[]" : " BODY.PEEK[]");
1235 else
1236 command.append(first ? "RFC822" : " RFC822");
1237 first = false;
1238 }
1239 if (fp.contains(FetchProfile.Item.SIZE) ||
1240 fp.contains(IMAPFolder.FetchProfileItem.SIZE)) {
1241 command.append(first ? "RFC822.SIZE" : " RFC822.SIZE");
1242 first = false;
1243 }
1244 if (fp.contains(IMAPFolder.FetchProfileItem.INTERNALDATE)) {
1245 command.append(first ? "INTERNALDATE" : " INTERNALDATE");
1246 first = false;

Callers 4

setFlagsMethod · 0.95
copymoveMessagesMethod · 0.95
copymoveUIDMessagesMethod · 0.95
expungeMethod · 0.95

Calls 15

checkOpenedMethod · 0.95
getEnvelopeCommandMethod · 0.95
createHeaderCommandMethod · 0.95
toMessageSetSortedMethod · 0.95
getProtocolMethod · 0.95
getMessageBySeqNumberMethod · 0.95
getItemCountMethod · 0.95
getItemMethod · 0.95
handleFetchItemMethod · 0.95
getExtensionItemsMethod · 0.95
handleResponsesMethod · 0.95

Tested by

no test coverage detected