/** * UNSELECT Command. * * @exception ProtocolException for protocol failures * @see "RFC 3691" * @since JavaMail 1.4.4 */ public void unselect() throws ProtocolException { if (!hasCapability("UNSELECT")) throw new BadCommandException("UNSELECT not supported"); simpleCommand("UNSELECT", null); }
/** * UNSELECT Command. * * @exception ProtocolException for protocol failures * @see "RFC 3691" * @since JavaMail 1.4.4 */ public void unselect() throws ProtocolException { if (!hasCapability("UNSELECT")) throw new BadCommandException("UNSELECT not supported"); simpleCommand("UNSELECT", null); }
/** * UNAUTHENTICATE Command. * * @exception ProtocolException for protocol failures * @see "Netscape/iPlanet/SunONE Messaging Server extension" * @since JavaMail 1.5.1 */ public void unauthenticate() throws ProtocolException { if (!hasCapability("X-UNAUTHENTICATE")) throw new BadCommandException("UNAUTHENTICATE not supported"); simpleCommand("UNAUTHENTICATE", null); authenticated = false; }
/** * UNAUTHENTICATE Command. * * @exception ProtocolException for protocol failures * @see "Netscape/iPlanet/SunONE Messaging Server extension" * @since JavaMail 1.5.1 */ public void unauthenticate() throws ProtocolException { if (!hasCapability("X-UNAUTHENTICATE")) throw new BadCommandException("UNAUTHENTICATE not supported"); simpleCommand("UNAUTHENTICATE", null); authenticated = false; }
/** * ENABLE Command. * * @param cap the name of the capability to enable * @exception ProtocolException for protocol failures * @see "RFC 5161" * @since JavaMail 1.5.1 */ public void enable(String cap) throws ProtocolException { if (!hasCapability("ENABLE")) throw new BadCommandException("ENABLE not supported"); Argument args = new Argument(); args.writeAtom(cap); simpleCommand("ENABLE", args); if (enabled == null) enabled = new HashSet<String>(); enabled.add(cap.toUpperCase(Locale.ENGLISH)); }
/** * UID EXPUNGE Command. * * @param set UIDs to expunge * @exception ProtocolException for protocol failures * @see "RFC4315, section 2" */ public void uidexpunge(UIDSet[] set) throws ProtocolException { if (!hasCapability("UIDPLUS")) throw new BadCommandException("UID EXPUNGE not supported"); simpleCommand("UID EXPUNGE " + UIDSet.toString(set), null); }
/** * UID EXPUNGE Command. * * @param set UIDs to expunge * @exception ProtocolException for protocol failures * @see "RFC4315, section 2" */ public void uidexpunge(UIDSet[] set) throws ProtocolException { if (!hasCapability("UIDPLUS")) throw new BadCommandException("UID EXPUNGE not supported"); simpleCommand("UID EXPUNGE " + UIDSet.toString(set), null); }
/** * ENABLE Command. * * @param cap the name of the capability to enable * @exception ProtocolException for protocol failures * @see "RFC 5161" * @since JavaMail 1.5.1 */ public void enable(String cap) throws ProtocolException { if (!hasCapability("ENABLE")) throw new BadCommandException("ENABLE not supported"); Argument args = new Argument(); args.writeAtom(cap); simpleCommand("ENABLE", args); if (enabled == null) enabled = new HashSet<>(); enabled.add(cap.toUpperCase(Locale.ENGLISH)); // update the utf8 flag utf8 = isEnabled("UTF8=ACCEPT"); }
throw new BadCommandException("QUOTA not supported");
throw new BadCommandException("QUOTA not supported");
/** * MOVE Command, return uid from COPYUID response code. * * @see "RFC 6851" * @see "RFC 4315, section 3" * @since JavaMail 1.5.4 */ private CopyUID moveuid(String msgSequence, String mbox, boolean uid) throws ProtocolException { if (!hasCapability("MOVE")) throw new BadCommandException("MOVE not supported"); if (uid && !hasCapability("UIDPLUS")) throw new BadCommandException("UIDPLUS not supported"); Argument args = new Argument(); args.writeAtom(msgSequence); writeMailboxName(args, mbox); Response[] r = command("MOVE", args); // dispatch untagged responses notifyResponseHandlers(r); // Handle result of this command handleResult(r[r.length-1]); if (uid) return getCopyUID(r); else return null; }
/** * MOVE Command, return uid from COPYUID response code. * * @see "RFC 6851" * @see "RFC 4315, section 3" * @since JavaMail 1.5.4 */ private CopyUID moveuid(String msgSequence, String mbox, boolean uid) throws ProtocolException { if (!hasCapability("MOVE")) throw new BadCommandException("MOVE not supported"); if (uid && !hasCapability("UIDPLUS")) throw new BadCommandException("UIDPLUS not supported"); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeAtom(msgSequence); args.writeString(mbox); Response[] r = command("MOVE", args); // dispatch untagged responses notifyResponseHandlers(r); // Handle result of this command handleResult(r[r.length-1]); if (uid) return getCopyUID(r); else return null; }
/** * Convenience routine to handle OK, NO, BAD and BYE responses. * * @param response the response * @exception ProtocolException for protocol failures */ public void handleResult(Response response) throws ProtocolException { if (response.isOK()) return; else if (response.isNO()) throw new CommandFailedException(response); else if (response.isBAD()) throw new BadCommandException(response); else if (response.isBYE()) { disconnect(); throw new ConnectionException(this, response); } }
/** * Convenience routine to handle OK, NO, BAD and BYE responses. * * @param response the response * @exception ProtocolException for protocol failures */ public void handleResult(Response response) throws ProtocolException { if (response.isOK()) return; else if (response.isNO()) throw new CommandFailedException(response); else if (response.isBAD()) throw new BadCommandException(response); else if (response.isBYE()) { disconnect(); throw new ConnectionException(this, response); } }
throws ProtocolException { if (!hasCapability("ACL")) throw new BadCommandException("ACL not supported");
/** * DELETEACL Command. * * @param mbox the mailbox * @param user the user * @exception ProtocolException for protocol failures * @see "RFC2086" */ public void deleteACL(String mbox, String user) throws ProtocolException { if (!hasCapability("ACL")) throw new BadCommandException("ACL not supported"); Argument args = new Argument(); writeMailboxName(args, mbox); args.writeString(user); // XXX - could be UTF-8? Response[] r = command("DELETEACL", args); Response response = r[r.length-1]; // dispatch untagged responses notifyResponseHandlers(r); handleResult(response); }
throws ProtocolException { if (!hasCapability("ACL")) throw new BadCommandException("ACL not supported");
throw new BadCommandException("ACL not supported");
private CopyUID copyuid(String msgSequence, String mbox, boolean uid) throws ProtocolException { if (uid && !hasCapability("UIDPLUS")) throw new BadCommandException("UIDPLUS not supported"); Argument args = new Argument(); args.writeAtom(msgSequence); writeMailboxName(args, mbox); Response[] r = command("COPY", args); // dispatch untagged responses notifyResponseHandlers(r); // Handle result of this command handleResult(r[r.length-1]); if (uid) return getCopyUID(r); else return null; }
throw new BadCommandException("ACL not supported");