public boolean wasByeResponseReceived() { for (ImapResponse response : responses) { if (response.getTag() == null && response.size() >= 1 && equalsIgnoreCase(response.get(0), Responses.BYE)) { return true; } } return false; }
if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) { Timber.w("After sending tag %s, got tag response from previous command %s for %s", tag, response, logId); if (delResponse.getTag() != null || delResponse.size() < 2 || ( !equalsIgnoreCase(delResponse.get(1), Responses.EXISTS) && !equalsIgnoreCase(delResponse.get(1), Responses.EXPUNGE))) { if (response.getTag() == null && untaggedHandler != null) { untaggedHandler.handleAsyncUntaggedResponse(response); } while (response == null || response.getTag() == null);
private ImapResponse readContinuationResponse(String tag) throws IOException, MessagingException { ImapResponse response; do { response = readResponse(); String responseTag = response.getTag(); if (responseTag != null) { if (responseTag.equalsIgnoreCase(tag)) { throw new MessagingException("Command continuation aborted: " + response); } else { Timber.w("After sending tag %s, got tag response from previous command %s for %s", tag, response, getLogId()); } } } while (!response.isContinuationRequested()); return response; }
@Override public Object foundLiteral(ImapResponse response, FixedLengthInputStream literal) throws MessagingException, IOException { if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { ImapList fetchList = (ImapList)response.getKeyedValue("FETCH"); String uid = fetchList.getKeyedString("UID"); ImapMessage message = (ImapMessage) mMessageMap.get(uid); message.parse(literal); // Return placeholder object return 1; } return null; } }
@Override public Object foundLiteral(ImapResponse response, FixedLengthInputStream literal) throws IOException { if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { //TODO: check for correct UID String contentTransferEncoding = part.getHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; String contentType = part.getHeader(MimeHeader.HEADER_CONTENT_TYPE)[0]; return bodyFactory.createBody(contentTransferEncoding, contentType, literal); } return null; } }
if (response.getTag() == null && response.size() > 1) { try { Object responseType = response.get(1);
@Override protected void handleUntaggedResponse(ImapResponse response) { if (response.getTag() == null && response.size() > 1) { Object responseType = response.get(1); if (equalsIgnoreCase(responseType, "FETCH") || equalsIgnoreCase(responseType, "EXPUNGE") || equalsIgnoreCase(responseType, "EXISTS")) { if (K9MailLib.isDebug()) { Timber.d("Storing response %s for later processing", response); } synchronized (storedUntaggedResponses) { storedUntaggedResponses.add(response); } } handlePossibleUidNext(response); } }
response = connection.readResponse(callback); if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { ImapList fetchList = (ImapList) response.getKeyedValue("FETCH"); String uid = fetchList.getKeyedString("UID"); } while (response.getTag() == null); } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe);
public static CapabilityResponse parse(List<ImapResponse> responses) { for (ImapResponse response : responses) { CapabilityResponse result; if (!response.isEmpty() && equalsIgnoreCase(response.get(0), Responses.OK) && response.isList(1)) { ImapList capabilityList = response.getList(1); result = parse(capabilityList); } else if (response.getTag() == null) { result = parse(response); } else { result = null; } if (result != null) { return result; } } return null; }
@Test public void readResponseShouldReadWholeListResponseLine() throws Exception { ImapResponseParser parser = createParser("* LIST (\\HasNoChildren) \".\" [FolderName]\r\n" + "TAG OK [List complete]\r\n"); parser.readResponse(); ImapResponse responseTwo = parser.readResponse(); assertEquals("TAG", responseTwo.getTag()); }
response = connection.readResponse(callback); if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { ImapList fetchList = (ImapList) response.getKeyedValue("FETCH"); String uid = fetchList.getKeyedString("UID"); } while (response.getTag() == null); } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe);
eolOut.flush(); } while (response.getTag() == null);
/** * Handle an untagged response that the caller doesn't care to handle themselves. */ protected void handleUntaggedResponse(ImapResponse response) { if (response.getTag() == null && response.size() > 1) { if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXISTS")) { messageCount = response.getNumber(0); if (K9MailLib.isDebug()) { Timber.d("Got untagged EXISTS with value %d for %s", messageCount, getLogId()); } } handlePossibleUidNext(response); if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXPUNGE") && messageCount > 0) { messageCount--; if (K9MailLib.isDebug()) { Timber.d("Got untagged EXPUNGE with messageCount %d for %s", messageCount, getLogId()); } } } }
if (response.getTag() == null) { if (response.size() > 1) { Object responseType = response.get(1);