use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class NotificationActionService method markMessageAsSpam.
private void markMessageAsSpam(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService moving messages to spam");
String messageReferenceString = intent.getStringExtra(EXTRA_MESSAGE_REFERENCE);
MessageReference messageReference = MessageReference.parse(messageReferenceString);
if (messageReference == null) {
Timber.w("Invalid message reference: %s", messageReferenceString);
return;
}
String spamFolderName = account.getSpamFolderName();
if (spamFolderName != null && !K9.confirmSpam() && isMovePossible(controller, account, spamFolderName)) {
String sourceFolderName = messageReference.getFolderName();
controller.moveMessage(account, sourceFolderName, messageReference, spamFolderName);
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessagingController method actOnMessageGroup.
private void actOnMessageGroup(Account account, String folderName, List<MessageReference> messageReferences, MessageActor actor) {
try {
LocalFolder messageFolder = account.getLocalStore().getFolder(folderName);
List<LocalMessage> localMessages = messageFolder.getMessagesByReference(messageReferences);
actor.act(account, messageFolder, localMessages);
} catch (MessagingException e) {
Timber.e(e, "Error loading account?!");
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageListFragment method onArchive.
private void onArchive(final List<MessageReference> messages) {
Map<Account, List<MessageReference>> messagesByAccount = groupMessagesByAccount(messages);
for (Entry<Account, List<MessageReference>> entry : messagesByAccount.entrySet()) {
Account account = entry.getKey();
String archiveFolder = account.getArchiveFolderName();
if (!K9.FOLDER_NONE.equals(archiveFolder)) {
move(entry.getValue(), archiveFolder);
}
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageListFragment method getCheckedMessages.
private List<MessageReference> getCheckedMessages() {
List<MessageReference> messages = new ArrayList<>(selected.size());
for (int position = 0, end = adapter.getCount(); position < end; position++) {
Cursor cursor = (Cursor) adapter.getItem(position);
long uniqueId = cursor.getLong(uniqueIdColumn);
if (selected.contains(uniqueId)) {
MessageReference message = getMessageAtPosition(position);
if (message != null) {
messages.add(message);
}
}
}
return messages;
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageListFragment method getReferenceForPosition.
private MessageReference getReferenceForPosition(int position) {
Cursor cursor = (Cursor) adapter.getItem(position);
String accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
String messageUid = cursor.getString(UID_COLUMN);
return new MessageReference(accountUuid, folderName, messageUid, null);
}
Aggregations