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

Method Status

app/src/main/java/com/sun/mail/imap/protocol/Status.java:45–96  ·  view source on GitHub ↗
(Response r)

Source from the content-addressed store, hash-verified

43 { "MESSAGES", "RECENT", "UNSEEN", "UIDNEXT", "UIDVALIDITY" };
44
45 public Status(Response r) throws ParsingException {
46 // mailbox := astring
47 mbox = r.readAtomString();
48 if (!r.supportsUtf8())
49 mbox = BASE64MailboxDecoder.decode(mbox);
50
51 // Workaround buggy IMAP servers that don't quote folder names
52 // with spaces.
53 final StringBuilder buffer = new StringBuilder();
54 boolean onlySpaces = true;
55
56 while (r.peekByte() != '(' && r.peekByte() != 0) {
57 final char next = (char)r.readByte();
58
59 buffer.append(next);
60
61 if (next != ' ') {
62 onlySpaces = false;
63 }
64 }
65
66 if (!onlySpaces) {
67 mbox = (mbox + buffer).trim();
68 }
69
70 if (r.readByte() != '(')
71 throw new ParsingException("parse error in STATUS");
72
73 do {
74 String attr = r.readAtom();
75 if (attr == null)
76 throw new ParsingException("parse error in STATUS");
77 if (attr.equalsIgnoreCase("MESSAGES"))
78 total = r.readNumber();
79 else if (attr.equalsIgnoreCase("RECENT"))
80 recent = r.readNumber();
81 else if (attr.equalsIgnoreCase("UIDNEXT"))
82 uidnext = r.readLong();
83 else if (attr.equalsIgnoreCase("UIDVALIDITY"))
84 uidvalidity = r.readLong();
85 else if (attr.equalsIgnoreCase("UNSEEN"))
86 unseen = r.readNumber();
87 else if (attr.equalsIgnoreCase("HIGHESTMODSEQ"))
88 highestmodseq = r.readLong();
89 else {
90 if (items == null)
91 items = new HashMap<>();
92 items.put(attr.toUpperCase(Locale.ENGLISH),
93 Long.valueOf(r.readLong()));
94 }
95 } while (!r.isNextNonSpace(')'));
96 }
97
98 /**
99 * Get the value for the STATUS item.

Callers

nothing calls this directly

Calls 12

decodeMethod · 0.95
readAtomStringMethod · 0.80
peekByteMethod · 0.80
readByteMethod · 0.80
trimMethod · 0.80
readAtomMethod · 0.80
readNumberMethod · 0.80
readLongMethod · 0.80
isNextNonSpaceMethod · 0.80
supportsUtf8Method · 0.45
appendMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected