1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Fix not marking messages as read on viewing

This commit is contained in:
cketti 2013-02-06 17:37:00 +01:00
parent 07490613b6
commit 74bbbe7ea5

View File

@ -3080,21 +3080,13 @@ public class MessagingController implements Runnable {
!message.isSet(Flag.X_DOWNLOADED_PARTIAL)) { !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
if (loadMessageForViewRemoteSynchronous(account, folder, uid, listener, if (loadMessageForViewRemoteSynchronous(account, folder, uid, listener,
false, true)) { false, true)) {
if (account.isMarkMessageAsReadOnView() && !message.isSet(Flag.SEEN)) {
message.setFlag(Flag.SEEN, true);
setFlagSynchronous(account, Collections.singletonList(Long.valueOf(message.getId())), Flag.SEEN, true, false); markMessageAsReadOnView(account, message);
// setFlag(Collections.singletonList((Message) message),
// Flag.SEEN, true);
}
} }
return; return;
} }
if (!message.isSet(Flag.SEEN)) {
message.setFlag(Flag.SEEN, true); markMessageAsReadOnView(account, message);
setFlagSynchronous(account, Collections.singletonList(Long.valueOf(message.getId())), Flag.SEEN, true, false);
// setFlag(Collections.singletonList((Message) message), Flag.SEEN, true);
}
for (MessagingListener l : getListeners(listener)) { for (MessagingListener l : getListeners(listener)) {
l.loadMessageForViewHeadersAvailable(account, folder, uid, message); l.loadMessageForViewHeadersAvailable(account, folder, uid, message);
@ -3127,6 +3119,29 @@ public class MessagingController implements Runnable {
}); });
} }
/**
* Mark the provided message as read if not disabled by the account setting.
*
* @param account
* The account the message belongs to.
* @param message
* The message to mark as read. This {@link Message} instance will be modify by calling
* {@link Message#setFlag(Flag, boolean)} on it.
*
* @throws MessagingException
*
* @see Account#isMarkMessageAsReadOnView()
*/
private void markMessageAsReadOnView(Account account, Message message)
throws MessagingException {
if (account.isMarkMessageAsReadOnView() && !message.isSet(Flag.SEEN)) {
message.setFlag(Flag.SEEN, true);
setFlagSynchronous(account, Collections.singletonList(Long.valueOf(message.getId())),
Flag.SEEN, true, false);
}
}
/** /**
* Attempts to load the attachment specified by part from the given account and message. * Attempts to load the attachment specified by part from the given account and message.
* @param account * @param account