You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/03/07 02:22:53 UTC
(james-project) 04/09: [IMPROVE] SelectedMailboxImpl: simplify RECENT flag event handling
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 6cf53137d540ee518468dc9987d0399e9c80c597
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Mon Mar 4 07:56:24 2024 +0100
[IMPROVE] SelectedMailboxImpl: simplify RECENT flag event handling
- Explicitly work on current SelectedMailboxImpl
- MailboxId condition was already checked
- Avoid while loop
---
.../imap/processor/base/SelectedMailboxImpl.java | 26 +++++++---------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
index 4449027383..aace0e0af7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
@@ -444,24 +444,14 @@ public class SelectedMailboxImpl implements SelectedMailbox, EventListener.React
}
}
- 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 (UpdatedFlags u : uflags) {
- Iterator<Flag> flags = u.modifiedSystemFlags().iterator();
-
- while (flags.hasNext()) {
- if (Flag.RECENT.equals(flags.next())) {
- MailboxId id = sm.getMailboxId();
- if (id != null && id.equals(updated.getMailboxId())) {
- sm.addRecent(u.getUid());
- }
- }
- }
+ // 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 (UpdatedFlags u : uflags) {
+ if (u.modifiedSystemFlags().contains(Flag.RECENT)) {
+ recentUids.add(u.getUid());
}
}
long stamp = applicableFlagsLock.writeLock();
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org