inbox.doCommand(new CustomProtocolCommand(start, end));
/** * Get the separator character. */ public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ @Override public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
lname = fullName; li = (ListInfo[])doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { return p.list("", lname);
lname = fullName; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException {
@Override public void stop() { runnning = false; // perform a NOOP to interrupt IDLE try { folder.doCommand(new IMAPFolder.ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { p.simpleCommand("NOOP", null); return null; } }); } catch (MessagingException e) { // ignore } }
doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException {
doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p)
/** * Get the separator character. */ public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ @Override public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ @Override public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ @Override public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
/** * Get the separator character. */ @Override public synchronized char getSeparator() throws MessagingException { if (separator == UNKNOWN_SEPARATOR) { ListInfo[] li = null; li = (ListInfo[])doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p) throws ProtocolException { // REV1 allows the following LIST format to obtain // the hierarchy delimiter of non-existent folders if (p.isREV1()) // IMAP4rev1 return p.list(fullName, ""); else // IMAP4, note that this folder must exist for this // to work :( return p.list("", fullName); } }); if (li != null) separator = li[0].separator; else separator = '/'; // punt ! } return separator; }
final Date dd = d; final Flags f = m.getFlags(); AppendUID auid = (AppendUID)doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException {
final Date dd = d; final Flags f = m.getFlags(); AppendUID auid = (AppendUID)doCommand(new ProtocolCommand() { @Override public Object doCommand(IMAPProtocol p)
private static RFC822DATA getRFC822Message(final IMAPFolder folder, final long uid) throws MessagingException { return (RFC822DATA) folder.doCommand(new IMAPFolder.ProtocolCommand() { 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); } }); }
/** * Returns a full message body * * @param folder Folder containing the message * @param uid Message UID * @return Returns size of the message * @throws MessagingException */ private static BODY getMessageBody(IMAPFolder folder, final Long uid) throws MessagingException { return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[])", null); logResponse(r); Response response = r[r.length - 1]; // Grab response if (!response.isOK()) { throw new ProtocolException("Unable to retrieve message size"); } FetchResponse fetchResponse = (FetchResponse) r[0]; BODY body = (BODY) fetchResponse.getItem(BODY.class); return body; } }); }
lname = fullName; li = (ListInfo[])doCommand(new ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { return p.list("", lname);
/** * Returns BODY object containing desired message fragment * * @param folder Folder containing the message * @param uid Message UID * @param from starting byte * @param count bytes to read * @return BODY containing desired message fragment * @throws MessagingException */ private static BODY getMessageBodyPart(IMAPFolder folder, final Long uid, final Integer from, final Integer count) throws MessagingException { return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand() { public Object doCommand(IMAPProtocol p) throws ProtocolException { Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[]<" + from + "." + count + ">)", null); logResponse(r); Response response = r[r.length - 1]; // Grab response if (!response.isOK()) { throw new ProtocolException("Unable to retrieve message part <" + from + "." + count + ">"); } FetchResponse fetchResponse = (FetchResponse) r[0]; BODY body = (BODY) fetchResponse.getItem(com.sun.mail.imap.protocol.BODY.class); return body; } }); }