mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Bulk flagging (read/unread, flag/unflag) implemented.
Message List batch ops wired to bulk flagging. Manage batch button state when messages are deleted (from outside agents) while in batch mode. Remove throws clause from Folder.close() to make it easier to close folders where necessary. Eliminate some cruft from MessageList Consolidate unreadMessageCount fetching in notifyAccount
This commit is contained in:
parent
61319d8c21
commit
f1abdbb769
@ -616,7 +616,7 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(Email.LOG_TAG, "callbackRunner started");
|
Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner started");
|
||||||
}
|
}
|
||||||
while (stop == false)
|
while (stop == false)
|
||||||
{
|
{
|
||||||
@ -631,7 +631,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
Log.i(Email.LOG_TAG, "callbackRunner interrupted");
|
Log.i(Email.LOG_TAG, "listLocalMessages callbackRunner interrupted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -658,7 +658,7 @@ public class MessagingController implements Runnable
|
|||||||
latch.countDown();
|
latch.countDown();
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(Email.LOG_TAG, "callbackRunner finished");
|
Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void callbackPending()
|
private void callbackPending()
|
||||||
@ -1015,23 +1015,6 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
remoteMessageArray = null;
|
remoteMessageArray = null;
|
||||||
|
|
||||||
/*
|
|
||||||
* Get a list of the messages that are in the remote list but not on the
|
|
||||||
* local store, or messages that are in the local store but failed to download
|
|
||||||
* on the last sync. These are the new messages that we will download.
|
|
||||||
*/
|
|
||||||
// Iterator<Message> iter = remoteMessages.iterator();
|
|
||||||
// while (iter.hasNext()) {
|
|
||||||
// Message message = iter.next();
|
|
||||||
// Message localMessage = localUidMap.get(message.getUid());
|
|
||||||
// if (localMessage == null ||
|
|
||||||
// (!localMessage.isSet(Flag.DELETED) &&
|
|
||||||
// !localMessage.isSet(Flag.X_DOWNLOADED_FULL) &&
|
|
||||||
// !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))) {
|
|
||||||
// unsyncedMessages.add(message);
|
|
||||||
// iter.remove();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else if (remoteMessageCount < 0)
|
else if (remoteMessageCount < 0)
|
||||||
{
|
{
|
||||||
@ -1222,17 +1205,28 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is already downloaded");
|
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is already locally present");
|
||||||
}
|
}
|
||||||
String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message);
|
String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message);
|
||||||
if (newPushState != null)
|
if (newPushState != null)
|
||||||
{
|
{
|
||||||
localFolder.setPushState(newPushState);
|
localFolder.setPushState(newPushState);
|
||||||
}
|
}
|
||||||
|
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
||||||
|
{
|
||||||
|
if (Email.DEBUG)
|
||||||
|
{
|
||||||
|
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is downloaded, even partially; trying again");
|
||||||
|
}
|
||||||
|
unsyncedMessages.add(message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
syncFlagMessages.add(message);
|
syncFlagMessages.add(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log.i(Email.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages");
|
Log.i(Email.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages");
|
||||||
|
|
||||||
@ -1967,6 +1961,22 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void queueSetFlag(Account account, String folderName, String newState, String flag, String[] uids)
|
||||||
|
{
|
||||||
|
PendingCommand command = new PendingCommand();
|
||||||
|
command.command = PENDING_COMMAND_SET_FLAG;
|
||||||
|
int length = 3 + uids.length;
|
||||||
|
command.arguments = new String[length];
|
||||||
|
command.arguments[0] = folderName;
|
||||||
|
command.arguments[1] = newState;
|
||||||
|
command.arguments[2] = flag;
|
||||||
|
for (int i = 0; i < uids.length; i++)
|
||||||
|
{
|
||||||
|
command.arguments[3 + i] = uids[i];
|
||||||
|
}
|
||||||
|
queuePendingCommand(account, command);
|
||||||
|
processPendingCommands(account);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Processes a pending mark read or unread command.
|
* Processes a pending mark read or unread command.
|
||||||
*
|
*
|
||||||
@ -1977,19 +1987,20 @@ public class MessagingController implements Runnable
|
|||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
String folder = command.arguments[0];
|
String folder = command.arguments[0];
|
||||||
String uid = command.arguments[1];
|
|
||||||
|
|
||||||
if (account.getErrorFolderName().equals(folder))
|
if (account.getErrorFolderName().equals(folder))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newState = Boolean.parseBoolean(command.arguments[2]);
|
boolean newState = Boolean.parseBoolean(command.arguments[1]);
|
||||||
|
|
||||||
Flag flag = Flag.valueOf(command.arguments[3]);
|
Flag flag = Flag.valueOf(command.arguments[2]);
|
||||||
|
|
||||||
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
||||||
Folder remoteFolder = remoteStore.getFolder(folder);
|
Folder remoteFolder = remoteStore.getFolder(folder);
|
||||||
|
try
|
||||||
|
{
|
||||||
if (!remoteFolder.exists())
|
if (!remoteFolder.exists())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1999,16 +2010,30 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Message remoteMessage = null;
|
List<Message> messages = new ArrayList<Message>();
|
||||||
|
for (int i = 3; i < command.arguments.length; i++)
|
||||||
|
{
|
||||||
|
String uid = command.arguments[i];
|
||||||
if (!uid.startsWith(Email.LOCAL_UID_PREFIX))
|
if (!uid.startsWith(Email.LOCAL_UID_PREFIX))
|
||||||
{
|
{
|
||||||
remoteMessage = remoteFolder.getMessage(uid);
|
messages.add(remoteFolder.getMessage(uid));
|
||||||
}
|
}
|
||||||
if (remoteMessage == null)
|
}
|
||||||
|
|
||||||
|
if (messages.size() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
remoteMessage.setFlag(flag, newState);
|
remoteFolder.setFlags(messages.toArray(new Message[0]), new Flag[] { flag }, newState);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (remoteFolder != null)
|
||||||
|
{
|
||||||
|
remoteFolder.close(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException
|
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException
|
||||||
@ -2193,95 +2218,40 @@ public class MessagingController implements Runnable
|
|||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFlag(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark the message with the given account, folder and uid either Seen or not Seen.
|
|
||||||
* @param account
|
|
||||||
* @param folder
|
|
||||||
* @param uid
|
|
||||||
* @param seen
|
|
||||||
*/
|
|
||||||
public void markMessageRead(
|
|
||||||
final Account account,
|
final Account account,
|
||||||
final String folder,
|
final String folderName,
|
||||||
final String uid,
|
final Message[] messages,
|
||||||
final boolean seen)
|
|
||||||
{
|
|
||||||
setMessageFlag(account, folder, uid, Flag.SEEN, seen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark the message with the given account, folder and uid either Seen or not Seen.
|
|
||||||
* @param account
|
|
||||||
* @param folder
|
|
||||||
* @param uid
|
|
||||||
* @param seen
|
|
||||||
*/
|
|
||||||
public void markMessageRead(
|
|
||||||
final Account account,
|
|
||||||
final Folder folder,
|
|
||||||
final Message message,
|
|
||||||
final boolean seen)
|
|
||||||
{
|
|
||||||
setMessageFlag(account, folder, message, Flag.SEEN, seen);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlag(final Account account, final String folder, final Message[] messages, final Flag flag, final boolean newState)
|
|
||||||
{
|
|
||||||
for (Message message : messages)
|
|
||||||
{
|
|
||||||
setMessageFlag(account, folder, message.getUid(), flag, newState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageFlag(
|
|
||||||
final Account account,
|
|
||||||
final String folder,
|
|
||||||
final String uid,
|
|
||||||
final Flag flag,
|
final Flag flag,
|
||||||
final boolean newState)
|
final boolean newState)
|
||||||
{
|
{
|
||||||
// TODO: put this into the background, but right now that causes odd behavior
|
String[] uids = new String[messages.length];
|
||||||
// because the MessageList doesn't have its own cache of the flag states
|
for (int i = 0; i < messages.length; i++)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
uids[i] = messages[i].getUid();
|
||||||
Folder localFolder = localStore.getFolder(folder);
|
|
||||||
localFolder.open(OpenMode.READ_WRITE);
|
|
||||||
|
|
||||||
Message message = localFolder.getMessage(uid);
|
|
||||||
|
|
||||||
setMessageFlag(account, localFolder, message, flag, newState);
|
|
||||||
|
|
||||||
localFolder.close(false);
|
|
||||||
}
|
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
addErrorMessage(account, me);
|
|
||||||
|
|
||||||
throw new RuntimeException(me);
|
|
||||||
}
|
}
|
||||||
|
setFlag(account, folderName, uids, flag, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageFlag(
|
public void setFlag(
|
||||||
final Account account,
|
final Account account,
|
||||||
final Folder folder,
|
final String folderName,
|
||||||
final Message message,
|
final String[] uids,
|
||||||
final Flag flag,
|
final Flag flag,
|
||||||
final boolean newState)
|
final boolean newState)
|
||||||
{
|
{
|
||||||
// TODO: put this into the background, but right now that causes odd behavior
|
// TODO: put this into the background, but right now that causes odd behavior
|
||||||
// because the FolderMessageList doesn't have its own cache of the flag states
|
// because the FolderMessageList doesn't have its own cache of the flag states
|
||||||
|
Folder localFolder = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String uid = message.getUid();
|
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
||||||
String folderName = folder.getName();
|
localFolder = localStore.getFolder(folderName);
|
||||||
|
localFolder.open(OpenMode.READ_WRITE);
|
||||||
message.setFlag(flag, newState);
|
Message[] messages = new Message[uids.length];
|
||||||
|
for (int i = 0; i < uids.length; i++)
|
||||||
|
{
|
||||||
|
String uid = uids[i];
|
||||||
// Allows for re-allowing sending of messages that could not be sent
|
// Allows for re-allowing sending of messages that could not be sent
|
||||||
if (flag == Flag.FLAGGED && newState == false
|
if (flag == Flag.FLAGGED && newState == false
|
||||||
&& uid != null
|
&& uid != null
|
||||||
@ -2289,6 +2259,11 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
sendCount.remove(uid);
|
sendCount.remove(uid);
|
||||||
}
|
}
|
||||||
|
messages[i] = localFolder.getMessage(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
localFolder.setFlags(messages, new Flag[] {flag}, newState);
|
||||||
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
@ -2300,10 +2275,7 @@ public class MessagingController implements Runnable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingCommand command = new PendingCommand();
|
queueSetFlag(account, folderName, Boolean.toString(newState), flag.toString(), uids);
|
||||||
command.command = PENDING_COMMAND_SET_FLAG;
|
|
||||||
command.arguments = new String[] { folderName, uid, Boolean.toString(newState), flag.toString() };
|
|
||||||
queuePendingCommand(account, command);
|
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
catch (MessagingException me)
|
catch (MessagingException me)
|
||||||
@ -2312,6 +2284,13 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
throw new RuntimeException(me);
|
throw new RuntimeException(me);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (localFolder != null)
|
||||||
|
{
|
||||||
|
localFolder.close(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}//setMesssageFlag
|
}//setMesssageFlag
|
||||||
|
|
||||||
public void clearAllPending(final Account account)
|
public void clearAllPending(final Account account)
|
||||||
@ -2386,7 +2365,7 @@ public class MessagingController implements Runnable
|
|||||||
// This is a view message request, so mark it read
|
// This is a view message request, so mark it read
|
||||||
if (!message.isSet(Flag.SEEN))
|
if (!message.isSet(Flag.SEEN))
|
||||||
{
|
{
|
||||||
markMessageRead(account, localFolder, message, true);
|
setFlag(account, localFolder.getName(), new Message[] { message }, Flag.SEEN, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null && !getListeners().contains(listener))
|
if (listener != null && !getListeners().contains(listener))
|
||||||
@ -2422,28 +2401,14 @@ public class MessagingController implements Runnable
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (remoteFolder!=null)
|
if (remoteFolder!=null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
remoteFolder.close(false);
|
remoteFolder.close(false);
|
||||||
}
|
}
|
||||||
catch (MessagingException e)
|
|
||||||
{
|
|
||||||
Log.w(Email.LOG_TAG, null, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localFolder!=null)
|
if (localFolder!=null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
localFolder.close(false);
|
localFolder.close(false);
|
||||||
}
|
}
|
||||||
catch (MessagingException e)
|
|
||||||
{
|
|
||||||
Log.w(Email.LOG_TAG, null, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//finally
|
}//finally
|
||||||
}//run
|
}//run
|
||||||
});
|
});
|
||||||
@ -2504,7 +2469,7 @@ public class MessagingController implements Runnable
|
|||||||
localFolder.close(false);
|
localFolder.close(false);
|
||||||
if (!message.isSet(Flag.SEEN))
|
if (!message.isSet(Flag.SEEN))
|
||||||
{
|
{
|
||||||
markMessageRead(account, localFolder, message, true);
|
setFlag(account, localFolder.getName(), new Message[] { message }, Flag.SEEN, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
@ -3346,10 +3311,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
else if (folder.equals(account.getTrashFolderName()) && account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
|
else if (folder.equals(account.getTrashFolderName()) && account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
|
||||||
{
|
{
|
||||||
PendingCommand command = new PendingCommand();
|
queueSetFlag(account, folder, Boolean.toString(true), Flag.DELETED.toString(), new String[] { origUid });
|
||||||
command.command = PENDING_COMMAND_SET_FLAG;
|
|
||||||
command.arguments = new String[] { folder, origUid, Boolean.toString(true), Flag.DELETED.toString() };
|
|
||||||
queuePendingCommand(account, command);
|
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
else if (account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
|
else if (account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE)
|
||||||
@ -3362,10 +3324,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ)
|
else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ)
|
||||||
{
|
{
|
||||||
PendingCommand command = new PendingCommand();
|
queueSetFlag(account, folder, Boolean.toString(true), Flag.SEEN.toString(), new String[] { origUid });
|
||||||
command.command = PENDING_COMMAND_SET_FLAG;
|
|
||||||
command.arguments = new String[] { folder, origUid, Boolean.toString(true), Flag.SEEN.toString() };
|
|
||||||
queuePendingCommand(account, command);
|
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3813,13 +3772,22 @@ public class MessagingController implements Runnable
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyAccount(Context context, Account thisAccount, int newMailCount, int unreadMessageCount)
|
public void notifyAccount(Context context, Account thisAccount, int newMailCount)
|
||||||
{
|
{
|
||||||
Log.i(Email.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount
|
int unreadMessageCount = 0;
|
||||||
+ ", unreadMessageCount = " + unreadMessageCount);
|
try
|
||||||
|
{
|
||||||
|
unreadMessageCount = thisAccount.getUnreadMessageCount(context, mApplication);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Unable to get unread message count", e);
|
||||||
|
}
|
||||||
|
Log.i(Email.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount);
|
||||||
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
|
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
|
||||||
if (isNotifyAccount)
|
if (isNotifyAccount)
|
||||||
{
|
{
|
||||||
|
|
||||||
NotificationManager notifMgr =
|
NotificationManager notifMgr =
|
||||||
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (newMailCount > 0 && unreadMessageCount > 0)
|
if (newMailCount > 0 && unreadMessageCount > 0)
|
||||||
@ -3858,6 +3826,10 @@ public class MessagingController implements Runnable
|
|||||||
notifMgr.cancel(thisAccount.getAccountNumber());
|
notifMgr.cancel(thisAccount.getAccountNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (MessagingListener l : getListeners())
|
||||||
|
{
|
||||||
|
l.accountStatusChanged(thisAccount, unreadMessageCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4131,14 +4103,12 @@ public class MessagingController implements Runnable
|
|||||||
localFolder.setLastPush(System.currentTimeMillis());
|
localFolder.setLastPush(System.currentTimeMillis());
|
||||||
localFolder.setStatus(null);
|
localFolder.setStatus(null);
|
||||||
|
|
||||||
int unreadMessageCount = account.getUnreadMessageCount(mApplication, mApplication);
|
Log.i(Email.LOG_TAG, "messagesArrived newCount = " + newCount);
|
||||||
Log.i(Email.LOG_TAG, "messagesArrived newCount = " + newCount + ", unreadMessageCount = " + unreadMessageCount);
|
notifyAccount(mApplication, account, newCount);
|
||||||
notifyAccount(mApplication, account, newCount, unreadMessageCount);
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
l.folderStatusChanged(account, remoteFolder.getName());
|
l.folderStatusChanged(account, remoteFolder.getName());
|
||||||
l.accountStatusChanged(account, unreadMessageCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1373,14 +1373,8 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
this.unreadMessageCount = unreadCount;
|
this.unreadMessageCount = unreadCount;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
folder.close(false);
|
folder.close(false);
|
||||||
}
|
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Folder.close() failed", me);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true");
|
Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true");
|
||||||
// TODO: Really, we should wait until we send the message, but that would require saving the original
|
// TODO: Really, we should wait until we send the message, but that would require saving the original
|
||||||
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
|
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
|
||||||
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, mFolder, mSourceMessageUid, Flag.ANSWERED, true);
|
MessagingController.getInstance(getApplication()).setFlag(mAccount, mFolder, new String[] { mSourceMessageUid }, Flag.ANSWERED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
@ -196,11 +196,17 @@ public class MessageList
|
|||||||
case MSG_REMOVE_MESSAGE:
|
case MSG_REMOVE_MESSAGE:
|
||||||
{
|
{
|
||||||
List<MessageInfoHolder> messages = (List<MessageInfoHolder>)((Object[]) msg.obj)[0];
|
List<MessageInfoHolder> messages = (List<MessageInfoHolder>)((Object[]) msg.obj)[0];
|
||||||
|
|
||||||
for (MessageInfoHolder message : messages)
|
for (MessageInfoHolder message : messages)
|
||||||
{
|
{
|
||||||
|
if (message != null && message.selected && mSelectedCount > 0)
|
||||||
|
{
|
||||||
|
mSelectedCount--;
|
||||||
|
}
|
||||||
mAdapter.messages.remove(message);
|
mAdapter.messages.remove(message);
|
||||||
}
|
}
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
|
configureBatchButtons();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,11 +881,6 @@ public class MessageList
|
|||||||
|
|
||||||
private void onDelete(MessageInfoHolder holder, int position)
|
private void onDelete(MessageInfoHolder holder, int position)
|
||||||
{
|
{
|
||||||
if (holder.read == false && holder.folder.unreadMessageCount > 0)
|
|
||||||
{
|
|
||||||
holder.folder.unreadMessageCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
mAdapter.removeMessage(holder);
|
mAdapter.removeMessage(holder);
|
||||||
MessagingController.getInstance(getApplication()).deleteMessage(mAccount, holder.message.getFolder().getName(), holder.message, null);
|
MessagingController.getInstance(getApplication()).deleteMessage(mAccount, holder.message.getFolder().getName(), holder.message, null);
|
||||||
mListView.setSelection(position);
|
mListView.setSelection(position);
|
||||||
@ -986,14 +987,6 @@ public class MessageList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.read == false)
|
|
||||||
{
|
|
||||||
if (holder.folder.unreadMessageCount > 0)
|
|
||||||
{
|
|
||||||
holder.folder.unreadMessageCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mAdapter.removeMessage(holder);
|
mAdapter.removeMessage(holder);
|
||||||
MessagingController.getInstance(getApplication()).moveMessage(mAccount, holder.message.getFolder().getName(), holder.message, folderName, null);
|
MessagingController.getInstance(getApplication()).moveMessage(mAccount, holder.message.getFolder().getName(), holder.message, folderName, null);
|
||||||
|
|
||||||
@ -1085,8 +1078,6 @@ public class MessageList
|
|||||||
holder.read = true;
|
holder.read = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentFolder.unreadMessageCount = 0;
|
|
||||||
|
|
||||||
mHandler.sortMessages();
|
mHandler.sortMessages();
|
||||||
|
|
||||||
|
|
||||||
@ -1111,15 +1102,7 @@ public class MessageList
|
|||||||
|
|
||||||
private void onToggleRead(MessageInfoHolder holder)
|
private void onToggleRead(MessageInfoHolder holder)
|
||||||
{
|
{
|
||||||
|
MessagingController.getInstance(getApplication()).setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.SEEN, !holder.read);
|
||||||
holder.folder.unreadMessageCount += (holder.read ? 1 : -1);
|
|
||||||
|
|
||||||
if (holder.folder.unreadMessageCount < 0)
|
|
||||||
{
|
|
||||||
holder.folder.unreadMessageCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagingController.getInstance(getApplication()).markMessageRead(mAccount, holder.message.getFolder().getName(), holder.uid, !holder.read);
|
|
||||||
holder.read = !holder.read;
|
holder.read = !holder.read;
|
||||||
mHandler.sortMessages();
|
mHandler.sortMessages();
|
||||||
}
|
}
|
||||||
@ -1127,7 +1110,7 @@ public class MessageList
|
|||||||
private void onToggleFlag(MessageInfoHolder holder)
|
private void onToggleFlag(MessageInfoHolder holder)
|
||||||
{
|
{
|
||||||
|
|
||||||
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, holder.message.getFolder().getName(), holder.uid, Flag.FLAGGED, !holder.flagged);
|
MessagingController.getInstance(getApplication()).setFlag(mAccount, holder.message.getFolder().getName(), new String[] { holder.uid }, Flag.FLAGGED, !holder.flagged);
|
||||||
holder.flagged = !holder.flagged;
|
holder.flagged = !holder.flagged;
|
||||||
mHandler.sortMessages();
|
mHandler.sortMessages();
|
||||||
}
|
}
|
||||||
@ -1661,10 +1644,11 @@ public class MessageList
|
|||||||
|
|
||||||
public FolderInfoHolder getFolder(String folder)
|
public FolderInfoHolder getFolder(String folder)
|
||||||
{
|
{
|
||||||
|
LocalFolder local_folder = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LocalStore localStore = (LocalStore)Store.getInstance(mAccount.getLocalStoreUri(), getApplication());
|
LocalStore localStore = (LocalStore)Store.getInstance(mAccount.getLocalStoreUri(), getApplication());
|
||||||
LocalFolder local_folder = localStore.getFolder(folder);
|
local_folder = localStore.getFolder(folder);
|
||||||
return new FolderInfoHolder((Folder)local_folder);
|
return new FolderInfoHolder((Folder)local_folder);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -1672,6 +1656,13 @@ public class MessageList
|
|||||||
Log.e(Email.LOG_TAG, "getFolder(" + folder + ") goes boom: ",e);
|
Log.e(Email.LOG_TAG, "getFolder(" + folder + ") goes boom: ",e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (local_folder != null)
|
||||||
|
{
|
||||||
|
local_folder.close(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int NON_MESSAGE_ITEMS = 1;
|
private static final int NON_MESSAGE_ITEMS = 1;
|
||||||
@ -2121,20 +2112,12 @@ public class MessageList
|
|||||||
if (isChecked)
|
if (isChecked)
|
||||||
{
|
{
|
||||||
mSelectedCount++;
|
mSelectedCount++;
|
||||||
if (mSelectedCount > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
enableBatchButtons();
|
|
||||||
}
|
}
|
||||||
}
|
else if (mSelectedCount > 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mSelectedCount--;
|
mSelectedCount--;
|
||||||
if (mSelectedCount==0)
|
|
||||||
{
|
|
||||||
disableBatchButtons();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
showBatchButtons();
|
||||||
message.selected = isChecked;
|
message.selected = isChecked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2162,6 +2145,17 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
private void showBatchButtons()
|
private void showBatchButtons()
|
||||||
{
|
{
|
||||||
|
configureBatchButtons();
|
||||||
|
//TODO: Fade in animation
|
||||||
|
mBatchButtonArea.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureBatchButtons()
|
||||||
|
{
|
||||||
|
if (mSelectedCount < 0)
|
||||||
|
{
|
||||||
|
mSelectedCount = 0;
|
||||||
|
}
|
||||||
if (mSelectedCount==0)
|
if (mSelectedCount==0)
|
||||||
{
|
{
|
||||||
disableBatchButtons();
|
disableBatchButtons();
|
||||||
@ -2170,8 +2164,6 @@ public class MessageList
|
|||||||
{
|
{
|
||||||
enableBatchButtons();
|
enableBatchButtons();
|
||||||
}
|
}
|
||||||
//TODO: Fade in animation
|
|
||||||
mBatchButtonArea.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FooterViewHolder
|
class FooterViewHolder
|
||||||
@ -2180,65 +2172,27 @@ public class MessageList
|
|||||||
public TextView main;
|
public TextView main;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* THERE IS NO FUCKING REASON THIS IS CLONED HERE */
|
public class FolderInfoHolder
|
||||||
public class FolderInfoHolder implements Comparable<FolderInfoHolder>
|
|
||||||
{
|
{
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public String displayName;
|
public String displayName;
|
||||||
|
|
||||||
public long lastChecked;
|
|
||||||
|
|
||||||
public int unreadMessageCount;
|
|
||||||
|
|
||||||
public boolean loading;
|
public boolean loading;
|
||||||
|
|
||||||
public String status;
|
|
||||||
|
|
||||||
public boolean lastCheckFailed;
|
public boolean lastCheckFailed;
|
||||||
|
|
||||||
public boolean needsRefresh = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outbox is handled differently from any other folder.
|
* Outbox is handled differently from any other folder.
|
||||||
*/
|
*/
|
||||||
public boolean outbox;
|
public boolean outbox;
|
||||||
|
|
||||||
public int compareTo(FolderInfoHolder o)
|
|
||||||
{
|
|
||||||
String s1 = this.name;
|
|
||||||
String s2 = o.name;
|
|
||||||
|
|
||||||
if (Email.INBOX.equalsIgnoreCase(s1))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (Email.INBOX.equalsIgnoreCase(s2))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return s1.compareToIgnoreCase(s2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FolderInfoHolder(Folder folder)
|
public FolderInfoHolder(Folder folder)
|
||||||
{
|
{
|
||||||
populate(folder);
|
populate(folder);
|
||||||
}
|
}
|
||||||
public void populate(Folder folder)
|
public void populate(Folder folder)
|
||||||
{
|
{
|
||||||
int unreadCount = 0;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
folder.open(Folder.OpenMode.READ_WRITE);
|
|
||||||
unreadCount = folder.getUnreadMessageCount();
|
|
||||||
}
|
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Folder.getUnreadMessageCount() failed", me);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.name = folder.getName();
|
this.name = folder.getName();
|
||||||
|
|
||||||
if (this.name.equalsIgnoreCase(Email.INBOX))
|
if (this.name.equalsIgnoreCase(Email.INBOX))
|
||||||
@ -2270,63 +2224,55 @@ public class MessageList
|
|||||||
{
|
{
|
||||||
this.displayName = String.format(getString(R.string.special_mailbox_name_sent_fmt), this.name);
|
this.displayName = String.format(getString(R.string.special_mailbox_name_sent_fmt), this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastChecked = folder.getLastChecked();
|
|
||||||
|
|
||||||
String mess = truncateStatus(folder.getStatus());
|
|
||||||
|
|
||||||
this.status = mess;
|
|
||||||
|
|
||||||
this.unreadMessageCount = unreadCount;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
folder.close(false);
|
|
||||||
}
|
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Folder.close() failed", me);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
if (v==mBatchDeleteButton)
|
|
||||||
{
|
|
||||||
List<Message> messageList = new ArrayList<Message>();
|
List<Message> messageList = new ArrayList<Message>();
|
||||||
//TODO: Optimize i.e. batch all these operations
|
|
||||||
for (MessageInfoHolder holder : mAdapter.messages)
|
for (MessageInfoHolder holder : mAdapter.messages)
|
||||||
{
|
{
|
||||||
if (holder.selected)
|
if (holder.selected)
|
||||||
{
|
{
|
||||||
if (holder.read == false && holder.folder.unreadMessageCount > 0)
|
if (v == mBatchDeleteButton)
|
||||||
{
|
{
|
||||||
holder.folder.unreadMessageCount--;
|
|
||||||
}
|
|
||||||
mAdapter.removeMessage(holder);
|
mAdapter.removeMessage(holder);
|
||||||
|
}
|
||||||
|
else if (v == mBatchFlagButton)
|
||||||
|
{
|
||||||
|
holder.flagged = true;
|
||||||
|
}
|
||||||
|
else if (v == mBatchReadButton)
|
||||||
|
{
|
||||||
|
holder.read = true;
|
||||||
|
}
|
||||||
messageList.add(holder.message);
|
messageList.add(holder.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!messageList.isEmpty())
|
if (!messageList.isEmpty())
|
||||||
{
|
{
|
||||||
//We assume that all messages are in the same folder
|
if (mBatchDeleteButton == v)
|
||||||
String folderName = messageList.get(0).getFolder().getName();
|
{
|
||||||
MessagingController.getInstance(getApplication()).deleteMessageList(mAccount, folderName, messageList, null);
|
MessagingController.getInstance(getApplication()).deleteMessageList(mAccount, mCurrentFolder.name, messageList, null);
|
||||||
mSelectedCount = 0;
|
mSelectedCount = 0;
|
||||||
hideBatchButtons();
|
configureBatchButtons();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessagingController.getInstance(getApplication()).setFlag(mAccount, mCurrentFolder.name, messageList.toArray(new Message[0]),
|
||||||
|
(v == mBatchReadButton ? Flag.SEEN : Flag.FLAGGED), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Should not happen
|
//Should not happen
|
||||||
Toast.makeText(this, R.string.no_message_seletected_toast, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.no_message_seletected_toast, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
mHandler.sortMessages();
|
||||||
else
|
|
||||||
{
|
|
||||||
Toast.makeText(this, "Not yet implemented", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -844,8 +844,8 @@ public class MessageView extends K9Activity
|
|||||||
{
|
{
|
||||||
if (mMessage != null)
|
if (mMessage != null)
|
||||||
{
|
{
|
||||||
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount,
|
MessagingController.getInstance(getApplication()).setFlag(mAccount,
|
||||||
mMessage.getFolder().getName(), mMessage.getUid(), Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
mMessage.getFolder().getName(), new String[] { mMessage.getUid() }, Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
||||||
@ -970,10 +970,11 @@ public class MessageView extends K9Activity
|
|||||||
{
|
{
|
||||||
if (mMessage != null)
|
if (mMessage != null)
|
||||||
{
|
{
|
||||||
MessagingController.getInstance(getApplication()).markMessageRead(
|
MessagingController.getInstance(getApplication()).setFlag(
|
||||||
mAccount,
|
mAccount,
|
||||||
mFolder,
|
mFolder,
|
||||||
mMessage.getUid(),
|
new String[] { mMessage.getUid() },
|
||||||
|
Flag.SEEN,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public abstract class Folder
|
|||||||
*
|
*
|
||||||
* @param expunge If true all deleted messages will be expunged.
|
* @param expunge If true all deleted messages will be expunged.
|
||||||
*/
|
*/
|
||||||
public abstract void close(boolean expunge) throws MessagingException;
|
public abstract void close(boolean expunge);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return True if further commands are not expected to have to open the
|
* @return True if further commands are not expected to have to open the
|
||||||
|
@ -613,7 +613,7 @@ public class ImapStore extends Store
|
|||||||
return mMode;
|
return mMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(boolean expunge) throws MessagingException
|
public void close(boolean expunge)
|
||||||
{
|
{
|
||||||
if (mMessageCount != -1)
|
if (mMessageCount != -1)
|
||||||
{
|
{
|
||||||
@ -624,10 +624,17 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
if (expunge)
|
if (expunge)
|
||||||
{
|
{
|
||||||
expunge();
|
expunge();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (MessagingException me)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Unable to expunge remote folder " + getName(), me);
|
||||||
|
}
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
releaseConnection(mConnection);
|
releaseConnection(mConnection);
|
||||||
|
@ -549,7 +549,7 @@ public class LocalStore extends Store implements Serializable
|
|||||||
sb.append(": ");
|
sb.append(": ");
|
||||||
for (String argument : arguments)
|
for (String argument : arguments)
|
||||||
{
|
{
|
||||||
sb.append(" ");
|
sb.append(", ");
|
||||||
sb.append(argument);
|
sb.append(argument);
|
||||||
//sb.append("\n");
|
//sb.append("\n");
|
||||||
}
|
}
|
||||||
@ -728,12 +728,19 @@ public class LocalStore extends Store implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(boolean expunge) throws MessagingException
|
public void close(boolean expunge)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (expunge)
|
if (expunge)
|
||||||
{
|
{
|
||||||
expunge();
|
expunge();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (MessagingException me)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Unable to close LocalFolder " + getName(), me);
|
||||||
|
}
|
||||||
mFolderId = -1;
|
mFolderId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,16 +811,14 @@ public class LocalStore extends Store implements Serializable
|
|||||||
{
|
{
|
||||||
open(OpenMode.READ_WRITE);
|
open(OpenMode.READ_WRITE);
|
||||||
Message[] messages = getMessages(null);
|
Message[] messages = getMessages(null);
|
||||||
for (int i = 0; i < messages.length; i++)
|
for (int i = mVisibleLimit; i < messages.length; i++)
|
||||||
{
|
|
||||||
if (i >= mVisibleLimit)
|
|
||||||
{
|
{
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
{
|
{
|
||||||
listener.messageRemoved(messages[i]);
|
listener.messageRemoved(messages[i]);
|
||||||
}
|
}
|
||||||
messages[i].setFlag(Flag.X_DESTROYED, true);
|
messages[i].setFlag(Flag.X_DESTROYED, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1148,16 +1148,9 @@ public class WebDavStore extends Store
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (tmpFolder != null)
|
if (tmpFolder != null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
tmpFolder.close(false);
|
tmpFolder.close(false);
|
||||||
}
|
}
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Caught MessagingException while closing folder " + tmpFolder.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1384,7 +1377,7 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(boolean expunge) throws MessagingException
|
public void close(boolean expunge)
|
||||||
{
|
{
|
||||||
this.mMessageCount = 0;
|
this.mMessageCount = 0;
|
||||||
this.mUnreadMessageCount = 0;
|
this.mUnreadMessageCount = 0;
|
||||||
|
@ -150,18 +150,7 @@ public class PollService extends CoreService
|
|||||||
Integer newMailCount = accountsChecked.get(thisAccount.getUuid());
|
Integer newMailCount = accountsChecked.get(thisAccount.getUuid());
|
||||||
if (newMailCount != null)
|
if (newMailCount != null)
|
||||||
{
|
{
|
||||||
try
|
MessagingController.getInstance(getApplication()).notifyAccount(context, thisAccount, newMailCount);
|
||||||
{
|
|
||||||
int unreadMessageCount = thisAccount.getUnreadMessageCount(context, getApplication());
|
|
||||||
MessagingController.getInstance(getApplication()).notifyAccount(context, thisAccount,
|
|
||||||
newMailCount, unreadMessageCount);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (MessagingException me)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "***** PollService *****: couldn't get unread count for account " +
|
|
||||||
thisAccount.getDescription(), me);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}//for accounts
|
}//for accounts
|
||||||
}//checkMailDone
|
}//checkMailDone
|
||||||
|
Loading…
Reference in New Issue
Block a user