Refine search
protocol.notifyResponseHandlers(r); protocol.handleResult(response);
/** * Get the sequence number for the given UID. Nothing is returned; * the FETCH UID response must be handled by the reponse handler, * along with any possible EXPUNGE responses, to ensure that the * UID is matched with the correct sequence number. * * @param uid the UID * @exception ProtocolException for protocol failures * @since JavaMail 1.5.3 */ public void fetchSequenceNumber(long uid) throws ProtocolException { Response[] r = fetch(String.valueOf(uid), "UID", true); notifyResponseHandlers(r); handleResult(r[r.length-1]); }
/** * Get the sequence number for the given UID. Nothing is returned; * the FETCH UID response must be handled by the reponse handler, * along with any possible EXPUNGE responses, to ensure that the * UID is matched with the correct sequence number. * * @param uid the UID * @exception ProtocolException for protocol failures * @since JavaMail 1.5.3 */ public void fetchSequenceNumber(long uid) throws ProtocolException { Response[] r = fetch(String.valueOf(uid), "UID", true); notifyResponseHandlers(r); handleResult(r[r.length-1]); }
/** * Get the sequence numbers for UIDs specified in the array. * Nothing is returned. The caller must map the UIDs to messages after * the FETCH UID responses have been handled by the reponse handler, * along with any possible EXPUNGE responses, to ensure that the * UIDs are matched with the correct sequence numbers. * * @param uids the UIDs * @exception ProtocolException for protocol failures * @since JavaMail 1.5.3 */ public void fetchSequenceNumbers(long[] uids) throws ProtocolException { StringBuffer sb = new StringBuffer(); for (int i = 0; i < uids.length; i++) { if (i > 0) sb.append(","); sb.append(String.valueOf(uids[i])); } Response[] r = fetch(sb.toString(), "UID", true); notifyResponseHandlers(r); handleResult(r[r.length-1]); }
/** * Get the sequence numbers for UIDs specified in the array. * Nothing is returned. The caller must map the UIDs to messages after * the FETCH UID responses have been handled by the reponse handler, * along with any possible EXPUNGE responses, to ensure that the * UIDs are matched with the correct sequence numbers. * * @param uids the UIDs * @exception ProtocolException for protocol failures * @since JavaMail 1.5.3 */ public void fetchSequenceNumbers(long[] uids) throws ProtocolException { StringBuilder sb = new StringBuilder(); for (int i = 0; i < uids.length; i++) { if (i > 0) sb.append(","); sb.append(String.valueOf(uids[i])); } Response[] r = fetch(sb.toString(), "UID", true); notifyResponseHandlers(r); handleResult(r[r.length-1]); }
notifyResponseHandlers(r); handleResult(r[r.length-1]);
notifyResponseHandlers(r); handleResult(r[r.length-1]);
notifyResponseHandlers(r); handleResult(r[r.length-1]);
notifyResponseHandlers(r); handleResult(r[r.length-1]);
/** * Process a response returned by readIdleResponse(). * This method will be called with appropriate locks * held so that the processing of the response is safe. * * @param r the response * @return true if IDLE is done * @exception ProtocolException for protocol failures * @since JavaMail 1.4.1 */ public boolean processIdleResponse(Response r) throws ProtocolException { Response[] responses = new Response[1]; responses[0] = r; boolean done = false; // done reading responses? notifyResponseHandlers(responses); if (r.isBYE()) // shouldn't wait for command completion response done = true; // If this is a matching command completion response, we are done if (r.isTagged() && r.getTag().equals(idleTag)) done = true; if (done) idleTag = null; // no longer in IDLE handleResult(r); return !done; }
/** * Process a response returned by readIdleResponse(). * This method will be called with appropriate locks * held so that the processing of the response is safe. * * @param r the response * @return true if IDLE is done * @exception ProtocolException for protocol failures * @since JavaMail 1.4.1 */ public boolean processIdleResponse(Response r) throws ProtocolException { Response[] responses = new Response[1]; responses[0] = r; boolean done = false; // done reading responses? notifyResponseHandlers(responses); if (r.isBYE()) // shouldn't wait for command completion response done = true; // If this is a matching command completion response, we are done if (r.isTagged() && r.getTag().equals(idleTag)) done = true; if (done) idleTag = null; // no longer in IDLE handleResult(r); return !done; }
private void storeFlags(String msgset, Flags flags, boolean set) throws ProtocolException { Response[] r; if (set) r = command("STORE " + msgset + " +FLAGS " + createFlagList(flags), null); else r = command("STORE " + msgset + " -FLAGS " + createFlagList(flags), null); // Dispatch untagged responses notifyResponseHandlers(r); handleResult(r[r.length-1]); }
private void storeFlags(String msgset, Flags flags, boolean set) throws ProtocolException { Response[] r; if (set) r = command("STORE " + msgset + " +FLAGS " + createFlagList(flags), null); else r = command("STORE " + msgset + " -FLAGS " + createFlagList(flags), null); // Dispatch untagged responses notifyResponseHandlers(r); handleResult(r[r.length-1]); }
/** * Fetch the FLAGS for the given message. * * @param msgno the message number * @return the Flags * @exception ProtocolException for protocol failures */ public Flags fetchFlags(int msgno) throws ProtocolException { Flags flags = null; Response[] r = fetch(msgno, "FLAGS"); // Search for our FLAGS response for (int i = 0, len = r.length; i < len; i++) { if (r[i] == null || !(r[i] instanceof FetchResponse) || ((FetchResponse)r[i]).getNumber() != msgno) continue; FetchResponse fr = (FetchResponse)r[i]; if ((flags = fr.getItem(FLAGS.class)) != null) { r[i] = null; // remove this response break; } } // dispatch untagged responses notifyResponseHandlers(r); handleResult(r[r.length-1]); return flags; }
/** * Fetch the FLAGS for the given message. * * @param msgno the message number * @return the Flags * @exception ProtocolException for protocol failures */ public Flags fetchFlags(int msgno) throws ProtocolException { Flags flags = null; Response[] r = fetch(msgno, "FLAGS"); // Search for our FLAGS response for (int i = 0, len = r.length; i < len; i++) { if (r[i] == null || !(r[i] instanceof FetchResponse) || ((FetchResponse)r[i]).getNumber() != msgno) continue; FetchResponse fr = (FetchResponse)r[i]; if ((flags = fr.getItem(FLAGS.class)) != null) { r[i] = null; // remove this response break; } } // dispatch untagged responses notifyResponseHandlers(r); handleResult(r[r.length-1]); return flags; }
/** * Fetch the BODYSTRUCTURE of the specified message. * * @param msgno the message number * @return the BODYSTRUCTURE item * @exception ProtocolException for protocol failures */ public BODYSTRUCTURE fetchBodyStructure(int msgno) throws ProtocolException { Response[] r = fetch(msgno, "BODYSTRUCTURE"); notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, BODYSTRUCTURE.class); else if (response.isNO()) return null; else { handleResult(response); return null; } }
/** * Fetch the IMAP UID for the given message. * * @param msgno the message number * @return the UID * @exception ProtocolException for protocol failures */ public UID fetchUID(int msgno) throws ProtocolException { Response[] r = fetch(msgno, "UID"); // dispatch untagged responses notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, UID.class); else if (response.isNO()) // XXX: Issue NOOP ? return null; else { handleResult(response); return null; // NOTREACHED } }
/** * Fetch the IMAP UID for the given message. * * @param msgno the message number * @return the UID * @exception ProtocolException for protocol failures */ public UID fetchUID(int msgno) throws ProtocolException { Response[] r = fetch(msgno, "UID"); // dispatch untagged responses notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, UID.class); else if (response.isNO()) // XXX: Issue NOOP ? return null; else { handleResult(response); return null; // NOTREACHED } }
/** * Fetch the IMAP MODSEQ for the given message. * * @param msgno the message number * @return the MODSEQ * @exception ProtocolException for protocol failures * @since JavaMail 1.5.1 */ public MODSEQ fetchMODSEQ(int msgno) throws ProtocolException { Response[] r = fetch(msgno, "MODSEQ"); // dispatch untagged responses notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, MODSEQ.class); else if (response.isNO()) // XXX: Issue NOOP ? return null; else { handleResult(response); return null; // NOTREACHED } }
/** * Fetch the BODYSTRUCTURE of the specified message. * * @param msgno the message number * @return the BODYSTRUCTURE item * @exception ProtocolException for protocol failures */ public BODYSTRUCTURE fetchBodyStructure(int msgno) throws ProtocolException { Response[] r = fetch(msgno, "BODYSTRUCTURE"); notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, BODYSTRUCTURE.class); else if (response.isNO()) return null; else { handleResult(response); return null; } }