MCPcopy Create free account
hub / github.com/M66B/FairEmail / getUnreadMessageCount

Method getUnreadMessageCount

app/src/main/java/javax/mail/Folder.java:781–798  ·  view source on GitHub ↗

Get the total number of unread messages in this Folder. This method can be invoked on a closed folder. However, note that for some folder implementations, getting the unread message count can be an expensive operation involving actually opening the folder. In such cases, a provider can choose n

()

Source from the content-addressed store, hash-verified

779 * @exception MessagingException for other failures
780 */
781 public synchronized int getUnreadMessageCount()
782 throws MessagingException {
783 if (!isOpen())
784 return -1;
785
786 int unread = 0;
787 int total = getMessageCount();
788 for (int i = 1; i <= total; i++) {
789 try {
790 if (!getMessage(i).isSet(Flags.Flag.SEEN))
791 unread++;
792 } catch (MessageRemovedException me) {
793 // This is an expunged message, ignore it.
794 continue;
795 }
796 }
797 return unread;
798 }
799
800 /**
801 * Get the number of deleted messages in this Folder. <p>

Callers

nothing calls this directly

Calls 4

isOpenMethod · 0.95
getMessageCountMethod · 0.95
getMessageMethod · 0.95
isSetMethod · 0.45

Tested by

no test coverage detected