/** * Constructs a LiteralException with the specified Response object. * * @param r the response object */ public LiteralException(Response r) { super(r.toString()); response = r; } }
/** * Constructs a ProtocolException with the specified Response object. * * @param r the Response */ public ProtocolException(Response r) { super(r.toString()); response = r; }
/** * Constructs a LiteralException with the specified Response object. * * @param r the response object */ public LiteralException(Response r) { super(r.toString()); response = r; } }
/** * Constructs a ProtocolException with the specified Response object. * * @param r the Response */ public ProtocolException(Response r) { super(r.toString()); response = r; }
@Override public String toString() { return toString(buffer, 0, size); }
/** * Return the rest of the response as a string, usually used to * return the arbitrary message text after a NO response. * * @return the rest of the response */ public String getRest() { skipSpaces(); return toString(buffer, index, size); }
/** * Extract a string stopping at control characters or any * character in delim. */ private String readDelimString(String delim) { skipSpaces(); if (index >= size) // already at end of response return null; int b; int start = index; while (index < size && ((b = (((int)buffer[index])&0xff)) >= ' ') && delim.indexOf((char)b) < 0 && b != 0x7f) index++; return toString(buffer, start, index); }
/** * Read a string as an arbitrary sequence of characters, * stopping at the delimiter Used to read part of a * response code inside []. * * @param delim the delimiter character * @return the string */ public String readString(char delim) { skipSpaces(); if (index >= size) // already at end of response return null; int start = index; while (index < size && buffer[index] != delim) index++; return toString(buffer, start, index); }
/** * Handle notifications and alerts. * Response must be an OK, NO, BAD, or BYE response. */ void handleResponseCode(Response r) { if (enableResponseEvents) notifyStoreListeners(IMAPStore.RESPONSE, r.toString()); String s = r.getRest(); // get the text after the response boolean isAlert = false; if (s.startsWith("[")) { // a response code int i = s.indexOf(']'); // remember if it's an alert if (i > 0 && s.substring(0, i + 1).equalsIgnoreCase("[ALERT]")) isAlert = true; // strip off the response code in any event s = s.substring(i + 1).trim(); } if (isAlert) notifyStoreListeners(StoreEvent.ALERT, s); else if (r.isUnTagged() && s.length() > 0) // Only send notifications that come with untagged // responses, and only if there is actually some // text there. notifyStoreListeners(StoreEvent.NOTICE, s); }
/** * Handle notifications and alerts. * Response must be an OK, NO, BAD, or BYE response. */ void handleResponseCode(Response r) { if (enableResponseEvents) notifyStoreListeners(IMAPStore.RESPONSE, r.toString()); String s = r.getRest(); // get the text after the response boolean isAlert = false; if (s.startsWith("[")) { // a response code int i = s.indexOf(']'); // remember if it's an alert if (i > 0 && s.substring(0, i + 1).equalsIgnoreCase("[ALERT]")) isAlert = true; // strip off the response code in any event s = s.substring(i + 1).trim(); } if (isAlert) notifyStoreListeners(StoreEvent.ALERT, s); else if (r.isUnTagged() && s.length() > 0) // Only send notifications that come with untagged // responses, and only if there is actually some // text there. notifyStoreListeners(StoreEvent.NOTICE, s); }
notifyStoreListeners(IMAPStore.RESPONSE, r.toString());
notifyStoreListeners(IMAPStore.RESPONSE, r.toString());
/** * Constructs a LiteralException with the specified Response object. */ public LiteralException(Response r) { super(r.toString()); response = r; } }
/** * Constructs a ProtocolException with the specified Response object. */ public ProtocolException(Response r) { super(r.toString()); response = r; }
if (response.toString().indexOf("READ-ONLY") != -1) minfo.mode = Folder.READ_ONLY; else
if (response.toString().indexOf("READ-ONLY") != -1) minfo.mode = Folder.READ_ONLY; else
/** * Return the rest of the response as a string, usually used to * return the arbitrary message text after a NO response. * * @return the rest of the response */ public String getRest() { skipSpaces(); return toString(buffer, index, size); }
logger.fine("UNEXPECTED RESPONSE : " + r.toString()); return;
logger.fine("UNEXPECTED RESPONSE : " + r.toString()); return;