mbox = r.readAtomString(); // mailbox := astring
// Workaround buggy IMAP servers that don't quote folder names
// with spaces.
final StringBuffer buffer = new StringBuffer();
boolean onlySpaces = true;
while (r.peekByte() != '(" && r.peekByte() != 0) {
final char next = (char)r.readByte();
buffer.append(next);
if (next != ' ") {
onlySpaces = false;
}
}
if (!onlySpaces) {
mbox = (mbox + buffer).trim();
}
if (r.readByte() != '(")
throw new ParsingException("parse error in STATUS");
do {
String attr = r.readAtom();
if (attr.equalsIgnoreCase("MESSAGES"))
total = r.readNumber();
else if (attr.equalsIgnoreCase("RECENT"))
recent = r.readNumber();
else if (attr.equalsIgnoreCase("UIDNEXT"))
uidnext = r.readLong();
else if (attr.equalsIgnoreCase("UIDVALIDITY"))
uidvalidity = r.readLong();
else if (attr.equalsIgnoreCase("UNSEEN"))
unseen = r.readNumber();
} while (r.readByte() != ')");