FlagsUpdated updated = (FlagsUpdated) messageEvent;
List<UpdatedFlags> uFlags = updated.getUpdatedFlags();
if (sessionId != eventSessionId || !silentFlagChanges) {
for (int i = 0; i < uFlags.size(); i++) {
UpdatedFlags u = uFlags.get(i);
if (interestingFlags(u)) {
flagUpdateUids.add(u.getUid());
}
}
}
SelectedMailbox sm = session.getSelected();
if (sm != null) {
// We need to add the UID of the message to the recent
// list if we receive an flag update which contains a
// \RECENT flag
// See IMAP-287
List<UpdatedFlags> uflags = updated.getUpdatedFlags();
for (int i = 0; i < uflags.size(); i++) {
UpdatedFlags u = uflags.get(i);
Iterator<Flag> flags = u.systemFlagIterator();
while (flags.hasNext()) {
if (Flag.RECENT.equals(flags.next())) {
MailboxPath path = sm.getPath();
if (path != null && path.equals(event.getMailboxPath())) {
sm.addRecent(u.getUid());
}
}
}