use of com.fsck.k9.controller.MessagingController in project k-9 by k9mail.
the class NotificationActionService method markMessagesAsRead.
private void markMessagesAsRead(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService marking messages as read");
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
for (MessageReference messageReference : messageReferences) {
String folderName = messageReference.getFolderName();
String uid = messageReference.getUid();
controller.setFlag(account, folderName, uid, Flag.SEEN, true);
}
}
use of com.fsck.k9.controller.MessagingController in project k-9 by k9mail.
the class NotificationActionService method archiveMessages.
private void archiveMessages(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService archiving messages");
String archiveFolderName = account.getArchiveFolderName();
if (archiveFolderName == null || (archiveFolderName.equals(account.getSpamFolderName()) && K9.confirmSpam()) || !isMovePossible(controller, account, archiveFolderName)) {
Timber.w("Can not archive messages");
return;
}
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
for (MessageReference messageReference : messageReferences) {
if (controller.isMoveCapable(messageReference)) {
String sourceFolderName = messageReference.getFolderName();
controller.moveMessage(account, sourceFolderName, messageReference, archiveFolderName);
}
}
}
use of com.fsck.k9.controller.MessagingController in project k-9 by k9mail.
the class MessagingController method getInstance.
public static synchronized MessagingController getInstance(Context context) {
if (inst == null) {
Context appContext = context.getApplicationContext();
NotificationController notificationController = NotificationController.newInstance(appContext);
Contacts contacts = Contacts.getInstance(context);
TransportProvider transportProvider = TransportProvider.getInstance();
inst = new MessagingController(appContext, notificationController, contacts, transportProvider);
}
return inst;
}
use of com.fsck.k9.controller.MessagingController in project k-9 by k9mail.
the class SaveMessageTask method doInBackground.
@Override
protected Void doInBackground(Void... params) {
final MessagingController messagingController = MessagingController.getInstance(context);
Message draftMessage = messagingController.saveDraft(account, message, draftId, saveRemotely);
draftId = messagingController.getId(draftMessage);
android.os.Message msg = android.os.Message.obtain(handler, MessageCompose.MSG_SAVED_DRAFT, draftId);
handler.sendMessage(msg);
return null;
}
use of com.fsck.k9.controller.MessagingController in project k-9 by k9mail.
the class Accounts method refresh.
private void refresh() {
accounts.clear();
accounts.addAll(Preferences.getPreferences(this).getAccounts());
// see if we should show the welcome message
// if (accounts.length < 1) {
// WelcomeMessage.showWelcomeMessage(this);
// finish();
// }
List<BaseAccount> newAccounts;
if (!K9.isHideSpecialAccounts() && accounts.size() > 0) {
if (mUnifiedInboxAccount == null || mAllMessagesAccount == null) {
createSpecialAccounts();
}
newAccounts = new ArrayList<BaseAccount>(accounts.size() + SPECIAL_ACCOUNTS_COUNT);
newAccounts.add(mUnifiedInboxAccount);
newAccounts.add(mAllMessagesAccount);
} else {
newAccounts = new ArrayList<BaseAccount>(accounts.size());
}
newAccounts.addAll(accounts);
mAdapter = new AccountsAdapter(newAccounts);
getListView().setAdapter(mAdapter);
if (!newAccounts.isEmpty()) {
mHandler.progress(Window.PROGRESS_START);
}
pendingWork.clear();
mHandler.refreshTitle();
MessagingController controller = MessagingController.getInstance(getApplication());
for (BaseAccount account : newAccounts) {
pendingWork.put(account, "true");
if (account instanceof Account) {
Account realAccount = (Account) account;
controller.getAccountStats(this, realAccount, mListener);
} else if (K9.countSearchMessages() && account instanceof SearchAccount) {
final SearchAccount searchAccount = (SearchAccount) account;
controller.getSearchAccountStats(searchAccount, mListener);
}
}
}
Aggregations