Merge branch 'readonly-p4-donut' into donut
This commit is contained in:
commit
085757aa51
@ -189,8 +189,10 @@ public class MessagingController implements Runnable {
|
|||||||
* listFoldersCallback for local folders before it returns, and then for
|
* listFoldersCallback for local folders before it returns, and then for
|
||||||
* remote folders at some later point. If there are no local folders
|
* remote folders at some later point. If there are no local folders
|
||||||
* includeRemote is forced by this method. This method should be called from
|
* includeRemote is forced by this method. This method should be called from
|
||||||
* a Thread as it may take several seconds to list the local folders. TODO
|
* a Thread as it may take several seconds to list the local folders.
|
||||||
* this needs to cache the remote folder list
|
*
|
||||||
|
* TODO this needs to cache the remote folder list
|
||||||
|
* TODO break out an inner listFoldersSynchronized which could simplify checkMail
|
||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
* @param includeRemote
|
* @param includeRemote
|
||||||
@ -1596,28 +1598,48 @@ public class MessagingController implements Runnable {
|
|||||||
*
|
*
|
||||||
* TODO: There is no use case for "check all accounts". Clean up this API to remove
|
* TODO: There is no use case for "check all accounts". Clean up this API to remove
|
||||||
* that case. Callers can supply the appropriate list.
|
* that case. Callers can supply the appropriate list.
|
||||||
|
*
|
||||||
|
* TODO: Better protection against a failure in account n, which should not prevent
|
||||||
|
* syncing account in accounts n+1 and beyond.
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @param accountsToCheck List of accounts to check, or null to check all accounts
|
* @param accounts List of accounts to check, or null to check all accounts
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public void checkMail(final Context context, final Account[] accountsToCheck,
|
public void checkMail(final Context context, Account[] accounts,
|
||||||
final MessagingListener listener) {
|
final MessagingListener listener) {
|
||||||
|
/**
|
||||||
|
* Note: The somewhat tortured logic here is to guarantee proper ordering of events:
|
||||||
|
* listeners: checkMailStarted
|
||||||
|
* account 1: list folders
|
||||||
|
* account 1: sync messages
|
||||||
|
* account 2: list folders
|
||||||
|
* account 2: sync messages
|
||||||
|
* ...
|
||||||
|
* account n: list folders
|
||||||
|
* account n: sync messages
|
||||||
|
* listeners: checkMailFinished
|
||||||
|
*/
|
||||||
synchronized (mListeners) {
|
synchronized (mListeners) {
|
||||||
for (MessagingListener l : mListeners) {
|
for (MessagingListener l : mListeners) {
|
||||||
l.checkMailStarted(context, null); // TODO this needs to pass the actual array
|
l.checkMailStarted(context, null); // TODO this needs to pass the actual array
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
put("checkMail", listener, new Runnable() {
|
if (accounts == null) {
|
||||||
public void run() {
|
accounts = Preferences.getPreferences(context).getAccounts();
|
||||||
Account[] accounts = accountsToCheck;
|
}
|
||||||
if (accounts == null) {
|
for (final Account account : accounts) {
|
||||||
accounts = Preferences.getPreferences(context).getAccounts();
|
listFolders(account, true, null);
|
||||||
}
|
|
||||||
for (Account account : accounts) {
|
put("checkMail", listener, new Runnable() {
|
||||||
|
public void run() {
|
||||||
sendPendingMessagesSynchronous(account);
|
sendPendingMessagesSynchronous(account);
|
||||||
synchronizeMailboxSynchronous(account, Email.INBOX);
|
synchronizeMailboxSynchronous(account, Email.INBOX);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
put("checkMailFinished", listener, new Runnable() {
|
||||||
|
public void run() {
|
||||||
synchronized (mListeners) {
|
synchronized (mListeners) {
|
||||||
for (MessagingListener l : mListeners) {
|
for (MessagingListener l : mListeners) {
|
||||||
l.checkMailFinished(context, null); // TODO this needs to pass actual array
|
l.checkMailFinished(context, null); // TODO this needs to pass actual array
|
||||||
|
Loading…
Reference in New Issue
Block a user