1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-02 00:25:10 -04:00

Fixes Issue 323

Fixes Issue 1105
Fixes Issue 1395
Fixes Issue 1421
Fixes Issue 1426

When the remote store is incapable of returning an unread message count (POP)
or a flagged message count (POP, WebDAV), count the number of local
messages with the desired atributes.
This commit is contained in:
Daniel Applebaum 2010-05-01 23:20:54 +00:00
parent f706861599
commit 68e7b7fa21

View File

@ -1298,12 +1298,21 @@ public class MessagingController implements Runnable
if (remoteUnreadMessageCount != -1)
{
localFolder.setUnreadMessageCount(remoteUnreadMessageCount);
return remoteUnreadMessageCount;
}
else
{
return localFolder.getMessageCount();
int unreadCount = 0;
Message[] messages = localFolder.getMessages(null, false);
for (Message message : messages)
{
if (message.isSet(Flag.SEEN) == false && message.isSet(Flag.DELETED) == false)
{
unreadCount++;
}
}
localFolder.setUnreadMessageCount(unreadCount);
}
return localFolder.getUnreadMessageCount();
}
private void setLocalFlaggedCountToRemote(LocalFolder localFolder, Folder remoteFolder) throws MessagingException
@ -1313,6 +1322,19 @@ public class MessagingController implements Runnable
{
localFolder.setFlaggedMessageCount(remoteFlaggedMessageCount);
}
else
{
int flaggedCount = 0;
Message[] messages = localFolder.getMessages(null, false);
for (Message message : messages)
{
if (message.isSet(Flag.FLAGGED) == true && message.isSet(Flag.DELETED) == false)
{
flaggedCount++;
}
}
localFolder.setFlaggedMessageCount(flaggedCount);
}
}
private int downloadMessages(final Account account, final Folder remoteFolder,