public Response[] fetch(int msg, String what) throws ProtocolException { return fetch(String.valueOf(msg), what, false); }
public Response[] fetch(int msg, String what) throws ProtocolException { return fetch(String.valueOf(msg), what, false); }
public Response[] fetch(int start, int end, String what) throws ProtocolException { return fetch(String.valueOf(start) + ":" + String.valueOf(end), what, false); }
public Response[] fetch(int start, int end, String what) throws ProtocolException { return fetch(String.valueOf(start) + ":" + String.valueOf(end), what, false); }
public Response[] fetch(MessageSet[] msgsets, String what) throws ProtocolException { return fetch(MessageSet.toString(msgsets), what, false); }
public Response[] fetch(MessageSet[] msgsets, String what) throws ProtocolException { return fetch(MessageSet.toString(msgsets), what, false); }
/** * 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 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 { 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]); }
/** * 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 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; } }
/** * 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 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 specified RFC822 Data item. 'what' names * the item to be fetched. 'what' can be <code>null</code> * to fetch the whole message. * * @param msgno the message number * @param what the item to fetch * @return the RFC822DATA item * @exception ProtocolException for protocol failures */ public RFC822DATA fetchRFC822(int msgno, String what) throws ProtocolException { Response[] r = fetch(msgno, what == null ? "RFC822" : "RFC822." + what ); // dispatch untagged responses notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, RFC822DATA.class); else if (response.isNO()) return null; else { handleResult(response); return null; } }
/** * Fetch the specified RFC822 Data item. 'what' names * the item to be fetched. 'what' can be <code>null</code> * to fetch the whole message. * * @param msgno the message number * @param what the item to fetch * @return the RFC822DATA item * @exception ProtocolException for protocol failures */ public RFC822DATA fetchRFC822(int msgno, String what) throws ProtocolException { Response[] r = fetch(msgno, what == null ? "RFC822" : "RFC822." + what ); // dispatch untagged responses notifyResponseHandlers(r); Response response = r[r.length-1]; if (response.isOK()) return FetchResponse.getItem(r, msgno, RFC822DATA.class); else if (response.isNO()) return null; else { handleResult(response); return null; } }