if (ir.keyEquals("EXISTS")) { total = ir.getNumber(); } else if (ir.keyEquals("RECENT")) { recent = ir.getNumber(); } else if (ir.keyEquals("FLAGS")) { availableFlags = new FLAGS(ir); } else if (ir.keyEquals("VANISHED")) { if (responses == null) responses = new ArrayList<>(); responses.add(ir); } else if (ir.keyEquals("FETCH")) { if (responses == null) responses = new ArrayList<>(); responses.add(ir); } else if (ir.isUnTagged() && ir.isOK()) { ir.skipSpaces(); if (ir.readByte() != '[') { // huh ??? ir.reset(); continue; String s = ir.readAtom(); if (s.equalsIgnoreCase("UNSEEN"))
/** * Read a response from the server. * * @return the response * @exception IOException for I/O errors * @exception ProtocolException for protocol failures */ public Response readResponse() throws IOException, ProtocolException { // assert Thread.holdsLock(this); // can't assert because it's called from constructor IMAPResponse r = new IMAPResponse(this); if (r.keyEquals("FETCH")) r = new FetchResponse(r, getFetchItems()); return r; }
private void init() throws IOException, ProtocolException { // continue parsing if this is an untagged response if (isUnTagged() && !isOK() && !isNO() && !isBAD() && !isBYE()) { key = readAtom(); // Is this response of the form "* <number> <command>" try { number = Integer.parseInt(key); key = readAtom(); } catch (NumberFormatException ne) { } } }
public ListInfo(IMAPResponse r) throws ParsingException { String[] s = r.readSimpleList(); r.skipSpaces(); if (r.readByte() == '"') { if ((separator = (char)r.readByte()) == '\\') separator = (char)r.readByte(); r.skip(1); // skip <"> } else // NIL r.skip(2); r.skipSpaces(); name = r.readAtomString();
if (ir.keyEquals("QUOTAROOT")) { ir.readAtomString(); while ((root = ir.readAtomString()) != null && root.length() > 0) tab.put(root, new Quota(root)); r[i] = null; } else if (ir.keyEquals("QUOTA")) { Quota quota = parseQuota(ir); Quota q = tab.get(quota.quotaRoot);
if (ir.keyEquals("EXISTS")) { // EXISTS int exists = ir.getNumber(); if (exists <= realTotal) } else if (ir.keyEquals("EXPUNGE")) { int seqnum = ir.getNumber(); Message[] msgs = null; if (doExpungeNotification && hasMessageCountListener) { notifyMessageRemovedListeners(false, msgs); } else if (ir.keyEquals("VANISHED")) { String[] s = ir.readAtomStringList(); if (s == null) { // no (EARLIER) String uids = ir.readAtom(); UIDSet[] uidset = UIDSet.parseUIDSets(uids); } else if (ir.keyEquals("FETCH")) { assert ir instanceof FetchResponse : "!ir instanceof FetchResponse"; Message msg = processFetchResponse((FetchResponse)ir); MessageChangedEvent.FLAGS_CHANGED, msg); } else if (ir.keyEquals("RECENT")) { recent = ir.getNumber();
msgno = r.getNumber(); r.skipSpaces(); String[] flags = r.readSimpleList(); if (flags != null) { // if not empty flaglist for (int i = 0; i < flags.length; i++) {
openEvents = new ArrayList<>(); for (IMAPResponse ir : mi.responses) { if (ir.keyEquals("VANISHED")) { String[] s = ir.readAtomStringList(); String uids = ir.readAtom(); UIDSet[] uidset = UIDSet.parseUIDSets(uids); long[] luid = UIDSet.toArray(uidset, uidnext); openEvents.add( new MessageVanishedEvent(this, luid)); } else if (ir.keyEquals("FETCH")) { assert ir instanceof FetchResponse : "!ir instanceof FetchResponse";
if (ir.keyEquals("SEARCH")) { while ((num = ir.readNumber()) != -1) v.add(Integer.valueOf(num)); r[i] = null;
/** * Handle any untagged CAPABILITY response in the Response array. * * @param r the responses */ public void handleCapabilityResponse(Response[] r) { boolean first = true; for (int i = 0, len = r.length; i < len; i++) { if (!(r[i] instanceof IMAPResponse)) continue; IMAPResponse ir = (IMAPResponse)r[i]; // Handle *all* untagged CAPABILITY responses. // Though the spec seemingly states that only // one CAPABILITY response string is allowed (6.1.1), // some server vendors claim otherwise. if (ir.keyEquals("CAPABILITY")) { if (first) { // clear out current when first response seen capabilities = new HashMap<>(10); authmechs = new ArrayList<>(5); first = false; } parseCapabilities(ir); } } }
if (ir.keyEquals("EXISTS")) { // EXISTS int exists = ir.getNumber(); if (exists <= realTotal) } else if (ir.keyEquals("EXPUNGE")) { int seqnum = ir.getNumber(); Message[] msgs = null; if (doExpungeNotification && hasMessageCountListener) { notifyMessageRemovedListeners(false, msgs); } else if (ir.keyEquals("FETCH")) { } else if (ir.keyEquals("RECENT")) { recent = ir.getNumber();
public ListInfo(IMAPResponse r) throws ParsingException { String[] s = r.readSimpleList(); r.skipSpaces(); if (r.readByte() == '"') { if ((separator = (char)r.readByte()) == '\\') separator = (char)r.readByte(); r.skip(1); // skip <"> } else // NIL r.skip(2); r.skipSpaces(); name = r.readAtomString(); if (!r.supportsUtf8())
if (ir.keyEquals("QUOTAROOT")) { ir.readAtomString(); while ((root = ir.readAtomString()) != null && root.length() > 0) tab.put(root, new Quota(root)); r[i] = null; } else if (ir.keyEquals("QUOTA")) { Quota quota = parseQuota(ir); Quota q = tab.get(quota.quotaRoot);
if (ir.keyEquals("EXISTS")) { // EXISTS int exists = ir.getNumber(); if (exists <= realTotal) } else if (ir.keyEquals("EXPUNGE")) { int seqnum = ir.getNumber(); if (seqnum > realTotal) { notifyMessageRemovedListeners(false, msgs); } else if (ir.keyEquals("VANISHED")) { String[] s = ir.readAtomStringList(); if (s == null) { // no (EARLIER) String uids = ir.readAtom(); UIDSet[] uidset = UIDSet.parseUIDSets(uids); } else if (ir.keyEquals("FETCH")) { assert ir instanceof FetchResponse : "!ir instanceof FetchResponse"; Message msg = processFetchResponse((FetchResponse)ir); MessageChangedEvent.FLAGS_CHANGED, msg); } else if (ir.keyEquals("RECENT")) { recent = ir.getNumber();
msgno = r.getNumber(); r.skipSpaces(); String[] flags = r.readSimpleList(); if (flags != null) { // if not empty flaglist for (int i = 0; i < flags.length; i++) {
openEvents = new ArrayList<MailEvent>(); for (IMAPResponse ir : mi.responses) { if (ir.keyEquals("VANISHED")) { String[] s = ir.readAtomStringList(); String uids = ir.readAtom(); UIDSet[] uidset = UIDSet.parseUIDSets(uids); long[] luid = UIDSet.toArray(uidset, uidnext); openEvents.add( new MessageVanishedEvent(this, luid)); } else if (ir.keyEquals("FETCH")) { assert ir instanceof FetchResponse : "!ir instanceof FetchResponse";
if (ir.keyEquals("SEARCH")) { while ((num = ir.readNumber()) != -1) v.add(Integer.valueOf(num)); r[i] = null;
/** * CAPABILITY command. * * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.1.1" */ public void capability() throws ProtocolException { // Check CAPABILITY Response[] r = command("CAPABILITY", null); Response response = r[r.length-1]; if (response.isOK()) { capabilities = new HashMap<String, String>(10); authmechs = new ArrayList<String>(5); for (int i = 0, len = r.length; i < len; i++) { if (!(r[i] instanceof IMAPResponse)) continue; IMAPResponse ir = (IMAPResponse)r[i]; // Handle *all* untagged CAPABILITY responses. // Though the spec seemingly states that only // one CAPABILITY response string is allowed (6.1.1), // some server vendors claim otherwise. if (ir.keyEquals("CAPABILITY")) parseCapabilities(ir); } } handleResult(response); }
if (ir.keyEquals("EXISTS")) { // EXISTS int exists = ir.getNumber(); if (exists <= realTotal) } else if (ir.keyEquals("EXPUNGE")) { IMAPMessage msg = getMessageBySeqNumber(ir.getNumber()); msg.setExpunged(true); // mark this message expunged. } else if (ir.keyEquals("FETCH")) { } else if (ir.keyEquals("RECENT")) { recent = ir.getNumber();