use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageViewFragment method refileMessage.
private void refileMessage(String dstFolder) {
String srcFolder = mMessageReference.getFolderName();
MessageReference messageToMove = mMessageReference;
mFragmentListener.showNextMessageOrReturn();
mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class RawMessageProvider method openFile.
@Override
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
List<String> segments = uri.getPathSegments();
String messageReferenceString = segments.get(0);
MessageReference messageReference = MessageReference.parse(messageReferenceString);
ParcelFileDescriptor parcelFileDescriptor = openMessage(messageReference);
if (parcelFileDescriptor == null) {
throw new FileNotFoundException("Message missing or cannot be opened!");
}
return parcelFileDescriptor;
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class RawMessageProvider method loadMessage.
private LocalMessage loadMessage(MessageReference messageReference) {
String accountUuid = messageReference.getAccountUuid();
long folderId = messageReference.getFolderId();
String uid = messageReference.getUid();
Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
if (account == null) {
Timber.w("Account not found: %s", accountUuid);
return null;
}
try {
LocalStore localStore = DI.get(LocalStoreProvider.class).getInstance(account);
LocalFolder localFolder = localStore.getFolder(folderId);
localFolder.open();
LocalMessage message = localFolder.getMessage(uid);
if (message == null || message.getDatabaseId() == 0) {
Timber.w("Message not found: folder=%s, uid=%s", folderId, uid);
return null;
}
FetchProfile fetchProfile = new FetchProfile();
fetchProfile.add(FetchProfile.Item.BODY);
localFolder.fetch(Collections.singletonList(message), fetchProfile, null);
return message;
} catch (MessagingException e) {
Timber.e(e, "Error loading message: folder=%d, uid=%s", folderId, uid);
return null;
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageViewFragment method onMoveToDrafts.
public void onMoveToDrafts() {
Account account = mAccount;
long folderId = mMessageReference.getFolderId();
List<MessageReference> messages = Collections.singletonList(mMessageReference);
mFragmentListener.showNextMessageOrReturn();
mController.moveToDraftsFolder(account, folderId, messages);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MlfUtils method setLastSelectedFolder.
static void setLastSelectedFolder(Preferences preferences, List<MessageReference> messages, long folderId) {
MessageReference firstMsg = messages.get(0);
Account account = preferences.getAccount(firstMsg.getAccountUuid());
account.setLastSelectedFolderId(folderId);
}
Aggregations