/** * 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); } } }
/** * 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; }
/** * Read a response from the server. * * @return the response * @exception IOException for I/O errors * @exception ProtocolException for protocol failures */ @Override 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; }
/** * 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(cmd)) { v.add(new ListInfo(ir)); r[i] = null;
if (ir.keyEquals("SEARCH")) { while ((num = ir.readNumber()) != -1) v.add(Integer.valueOf(num));
if (ir.keyEquals("SEARCH")) { while ((num = ir.readNumber()) != -1) v.add(Integer.valueOf(num));
if (ir.keyEquals(cmd)) { v.add(new ListInfo(ir)); r[i] = null;
if (ir.keyEquals("QUOTA")) { quota = parseQuota(ir); v.add(quota);
if (ir.keyEquals("QUOTA")) { quota = parseQuota(ir); v.add(quota);
if (ir.keyEquals("LISTRIGHTS")) {
if (ir.keyEquals("ACL")) {
if (ir.keyEquals("NAMESPACE")) { if (namespace == null) namespace = new Namespaces(ir);
if (ir.keyEquals("NAMESPACE")) { if (namespace == null) namespace = new Namespaces(ir);
if (ir.keyEquals("ID")) { if (id == null) id = new ID(ir);
if (ir.keyEquals("ID")) { if (id == null) id = new ID(ir);
if (ir.keyEquals("PREAUTH")) { authenticated = true; setCapabilities(r);
if (ir.keyEquals("PREAUTH")) { authenticated = true; setCapabilities(r);
if (ir.keyEquals("MYRIGHTS")) {
if (ir.keyEquals("MYRIGHTS")) {