if (r[i] instanceof IMAPResponse) { fetch = (FetchResponse) r[i]; body = (BODY) fetch.getItem(0); is = body.getByteArrayInputStream(); try {
Item item = f.getItem(j);
if ((u = fr.getItem(UID.class)) != null) v.add(u);
Item item = f.getItem(j);
if ((u = fr.getItem(UID.class)) != null) v.add(u);
Item item = f.getItem(j);
boolean notify = false; UID uid = fr.getItem(UID.class); if (uid != null && msg.getUID() != uid.uid) { msg.setUID(uid.uid); MODSEQ modseq = fr.getItem(MODSEQ.class); if (modseq != null && msg._getModSeq() != modseq.modseq) { msg.setModSeq(modseq.modseq); FLAGS flags = fr.getItem(FLAGS.class); if (flags != null) {
Item item = f.getItem(j);
boolean notify = false; UID uid = fr.getItem(UID.class); if (uid != null && msg.getUID() != uid.uid) { msg.setUID(uid.uid); MODSEQ modseq = fr.getItem(MODSEQ.class); if (modseq != null && msg._getModSeq() != modseq.modseq) { msg.setModSeq(modseq.modseq); FLAGS flags = fr.getItem(FLAGS.class); if (flags != null) {
/** * 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 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 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 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; } }
public Object doCommand(IMAPProtocol p) throws ProtocolException { Response[] r = p.command("UID FETCH " + uid + " (RFC822)", null); logResponse(r); Response response = r[r.length - 1]; if (!response.isOK()) { throw new ProtocolException("Unable to retrieve message in RFC822 format"); } FetchResponse fetchResponse = (FetchResponse) r[0]; return fetchResponse.getItem(RFC822DATA.class); } });