mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
further push down our "is this message for us" logic.
This commit is contained in:
parent
6c7782b4bd
commit
d60521f06f
@ -1574,18 +1574,9 @@ public class MessageList
|
||||
@Override
|
||||
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message)
|
||||
{
|
||||
if (updateForMe(account, folder))
|
||||
{
|
||||
FolderInfoHolder f = mCurrentFolder;
|
||||
// XXX TODO, this is the wrong folder
|
||||
if (f != null)
|
||||
{
|
||||
addOrUpdateMessage(account, f, message);
|
||||
}
|
||||
addOrUpdateMessage(account, folder, message);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxRemovedMessage(Account account, String folder,Message message)
|
||||
@ -1644,33 +1635,13 @@ public class MessageList
|
||||
@Override
|
||||
public void listLocalMessagesAddMessages(Account account, String folder, List<Message> messages)
|
||||
{
|
||||
if (updateForMe(account, folder))
|
||||
{
|
||||
FolderInfoHolder f = mCurrentFolder;
|
||||
|
||||
// xxx "f"?
|
||||
if (f != null)
|
||||
{
|
||||
addOrUpdateMessages(account, mCurrentFolder, messages);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addOrUpdateMessages(account, folder, messages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message)
|
||||
{
|
||||
if (updateForMe(account, folder))
|
||||
{
|
||||
FolderInfoHolder f = mCurrentFolder;
|
||||
// XXX TODO, this is the wrong folder
|
||||
if (f != null)
|
||||
{
|
||||
addOrUpdateMessage(account, f, message);
|
||||
}
|
||||
}
|
||||
|
||||
addOrUpdateMessage(account, folder, message);
|
||||
}
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folder, int unreadMessageCount)
|
||||
@ -1683,19 +1654,6 @@ public class MessageList
|
||||
}
|
||||
|
||||
|
||||
private boolean updateForMe(Account account, String folder)
|
||||
{
|
||||
if (mQueryString != null || (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void pendingCommandsProcessing(Account account)
|
||||
{
|
||||
@ -1720,6 +1678,19 @@ public class MessageList
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
private boolean updateForMe(Account account, String folder)
|
||||
{
|
||||
if (mQueryString != null || (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private Drawable mAttachmentIcon;
|
||||
private Drawable mAnsweredIcon;
|
||||
private View footerView = null;
|
||||
@ -1747,26 +1718,30 @@ public class MessageList
|
||||
removeMessages(messages);
|
||||
}
|
||||
|
||||
private void addOrUpdateMessage(Account account, FolderInfoHolder folder, Message message)
|
||||
private void addOrUpdateMessage(Account account, String folder, Message message)
|
||||
{
|
||||
List<Message> messages = new ArrayList<Message>();
|
||||
messages.add(message);
|
||||
addOrUpdateMessages(account, folder, messages);
|
||||
|
||||
}
|
||||
|
||||
private void addOrUpdateMessages(Account account, FolderInfoHolder folder, List<Message> messages)
|
||||
private void addOrUpdateMessages(Account account, String folder, List<Message> messages)
|
||||
{
|
||||
boolean needsSort = false;
|
||||
List<MessageInfoHolder> messagesToAdd = new ArrayList<MessageInfoHolder>();
|
||||
List<MessageInfoHolder> messagesToRemove = new ArrayList<MessageInfoHolder>();
|
||||
FolderInfoHolder f = mCurrentFolder; // This is wrong, but what the old code did.
|
||||
|
||||
for (Message message : messages)
|
||||
{
|
||||
if (updateForMe(account, folder))
|
||||
{
|
||||
MessageInfoHolder m = getMessage(message.getUid());
|
||||
|
||||
if (m == null)
|
||||
{
|
||||
m = new MessageInfoHolder(message, folder, account);
|
||||
m = new MessageInfoHolder(message, f, account);
|
||||
messagesToAdd.add(m);
|
||||
}
|
||||
else
|
||||
@ -1778,12 +1753,13 @@ public class MessageList
|
||||
}
|
||||
else
|
||||
{
|
||||
m.populate(message, folder, account);
|
||||
m.populate(message, f, account);
|
||||
needsSort = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (messagesToRemove.size() > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user