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

Method stat

app/src/main/java/com/sun/mail/pop3/Protocol.java:830–854  ·  view source on GitHub ↗

Return the total number of messages and mailbox size, using the STAT command.

()

Source from the content-addressed store, hash-verified

828 * using the STAT command.
829 */
830 synchronized Status stat() throws IOException {
831 Response r = simpleCommand("STAT");
832 Status s = new Status();
833
834 /*
835 * Normally the STAT command shouldn't fail but apparently it
836 * does when accessing Hotmail too often, returning:
837 * -ERR login allowed only every 15 minutes
838 * (Why it doesn't just fail the login, I don't know.)
839 * This is a serious failure that we don't want to hide
840 * from the user.
841 */
842 if (!r.ok)
843 throw new IOException("STAT command failed: " + r.data);
844
845 if (r.data != null) {
846 try {
847 StringTokenizer st = new StringTokenizer(r.data);
848 s.total = Integer.parseInt(st.nextToken());
849 s.size = Integer.parseInt(st.nextToken());
850 } catch (RuntimeException e) {
851 }
852 }
853 return s;
854 }
855
856 /**
857 * Return the size of the message using the LIST command.

Callers 1

openMethod · 0.80

Calls 3

simpleCommandMethod · 0.95
parseIntMethod · 0.45
nextTokenMethod · 0.45

Tested by

no test coverage detected