use of com.fsck.k9.mail.FetchProfile in project k-9 by k9mail.
the class ImapFolderTest method fetch_withBodyFetchProfileAndNoMaximumDownloadSize_shouldIssueRespectiveCommand.
@Test
public void fetch_withBodyFetchProfileAndNoMaximumDownloadSize_shouldIssueRespectiveCommand() throws Exception {
ImapFolder folder = createFolder("Folder");
prepareImapFolderForOpen(OPEN_MODE_RO);
folder.open(OPEN_MODE_RO);
when(imapConnection.readResponse(any(ImapResponseCallback.class))).thenReturn(createImapResponse("x OK"));
List<ImapMessage> messages = createImapMessages("1");
FetchProfile fetchProfile = createFetchProfile(Item.BODY);
folder.fetch(messages, fetchProfile, null);
verify(imapConnection).sendCommand("UID FETCH 1 (UID BODY.PEEK[])", false);
}
use of com.fsck.k9.mail.FetchProfile in project k-9 by k9mail.
the class ImapFolderTest method fetch_withNullMessageListArgument_shouldDoNothing.
@Test
public void fetch_withNullMessageListArgument_shouldDoNothing() throws Exception {
ImapFolder folder = createFolder("Folder");
FetchProfile fetchProfile = createFetchProfile();
folder.fetch(null, fetchProfile, null);
verifyNoMoreInteractions(imapStore);
}
use of com.fsck.k9.mail.FetchProfile in project k-9 by k9mail.
the class ImapFolderTest method fetch_withEnvelopeFetchProfile_shouldIssueRespectiveCommand.
@Test
public void fetch_withEnvelopeFetchProfile_shouldIssueRespectiveCommand() throws Exception {
ImapFolder folder = createFolder("Folder");
prepareImapFolderForOpen(OPEN_MODE_RO);
folder.open(OPEN_MODE_RO);
when(imapConnection.readResponse(any(ImapResponseCallback.class))).thenReturn(createImapResponse("x OK"));
List<ImapMessage> messages = createImapMessages("1");
FetchProfile fetchProfile = createFetchProfile(Item.ENVELOPE);
folder.fetch(messages, fetchProfile, null);
verify(imapConnection).sendCommand("UID FETCH 1 (UID INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS " + "(date subject from content-type to cc reply-to message-id references in-reply-to X-K9mail-Identity)]" + ")", false);
}
use of com.fsck.k9.mail.FetchProfile in project k-9 by k9mail.
the class ReconstructMessageFromDatabaseTest method readMessageFromDatabase.
protected LocalMessage readMessageFromDatabase(LocalFolder folder, MimeMessage message) throws MessagingException {
LocalMessage localMessage = folder.getMessage(message.getUid());
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.BODY);
folder.fetch(Collections.singletonList(localMessage), fp, null);
folder.close();
return localMessage;
}
use of com.fsck.k9.mail.FetchProfile in project sms-backup-plus by jberkel.
the class RestoreTask method importMessage.
@SuppressWarnings("unchecked")
private DataType importMessage(Message message) {
uids.add(message.getUid());
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.BODY);
DataType dataType = null;
try {
if (LOCAL_LOGV)
Log.v(TAG, "fetching message uid " + message.getUid());
message.getFolder().fetch(Collections.singletonList(message), fp, null);
dataType = converter.getDataType(message);
// only restore sms+call log for now
switch(dataType) {
case CALLLOG:
importCallLog(message);
break;
case SMS:
importSms(message);
break;
default:
if (LOCAL_LOGV)
Log.d(TAG, "ignoring restore of type: " + dataType);
}
} catch (MessagingException e) {
Log.e(TAG, ERROR, e);
} catch (IllegalArgumentException e) {
// http://code.google.com/p/android/issues/detail?id=2916
Log.e(TAG, ERROR, e);
} catch (IOException e) {
Log.e(TAG, ERROR, e);
}
return dataType;
}
Aggregations