(Response r)
| 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. |
nothing calls this directly
no test coverage detected