/** * If a SELECT succeeds, but indicates that the folder is * READ-ONLY, and the user asked to open the folder READ_WRITE, * do we allow the open to succeed? */ boolean allowReadOnlySelect() { return PropUtil.getBooleanProperty(session.getProperties(), "mail." + name + ".allowreadonlyselect", false); }
/** * Create an IMAPProtocol object connected to the host and port. * Subclasses of IMAPStore may override this method to return a * subclass of IMAPProtocol that supports product-specific extensions. * * @param host the host name * @param port the port number * @return the new IMAPProtocol object * @exception IOException for I/O errors * @exception ProtocolException for protocol errors * @since JavaMail 1.4.6 */ protected IMAPProtocol newIMAPProtocol(String host, int port) throws IOException, ProtocolException { return new IMAPProtocol(name, host, port, session.getProperties(), isSSL, logger ); }
/** * Create an IMAPProtocol object connected to the host and port. * Subclasses of IMAPStore may override this method to return a * subclass of IMAPProtocol that supports product-specific extensions. * * @param host the host name * @param port the port number * @return the new IMAPProtocol object * @exception IOException for I/O errors * @exception ProtocolException for protocol errors * @since JavaMail 1.4.6 */ protected IMAPProtocol newIMAPProtocol(String host, int port) throws IOException, ProtocolException { return new IMAPProtocol(name, host, port, session.getProperties(), isSSL, logger ); }
/** * Get an integer valued property. * * @param session the Session * @param name the property name * @param def default value if property not found * @return the property value */ @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); }
/** * Get a boolean valued property. * * @param session the Session * @param name the property name * @param def default value if property not found * @return the property value */ @Deprecated public static boolean getBooleanSessionProperty(Session session, String name, boolean def) { return getBoolean(getProp(session.getProperties(), name), def); }
/** * Get a boolean valued property. * * @param session the Session * @param name the property name * @param def default value if property not found * @return the property value */ public static boolean getBooleanSessionProperty(Session session, String name, boolean def) { return getBoolean(getProp(session.getProperties(), name), def); }
/** * Get an integer valued property. * * @param session the Session * @param name the property name * @param def default value if property not found * @return the property value */ public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); }
/** * Set the strict flag based on property. */ private void initStrict() { if (session != null) { Properties props = session.getProperties(); strict = PropUtil.getBooleanProperty(props, "mail.mime.address.strict", true); allowutf8 = PropUtil.getBooleanProperty(props, "mail.mime.allowutf8", false); } }
/** * Constructor that takes a Store object. * * @param store the Store that holds this folder */ protected Folder(Store store) { this.store = store; // create or choose the appropriate event queue Session session = store.getSession(); String scope = session.getProperties().getProperty("mail.event.scope", "folder"); Executor executor = (Executor)session.getProperties().get("mail.event.executor"); if (scope.equalsIgnoreCase("application")) q = EventQueue.getApplicationEventQueue(executor); else if (scope.equalsIgnoreCase("session")) q = session.getEventQueue(); else if (scope.equalsIgnoreCase("store")) q = store.getEventQueue(); else // if (scope.equalsIgnoreCase("folder")) q = new EventQueue(executor); }
/** * Constructor that takes a Store object. * * @param store the Store that holds this folder */ protected Folder(Store store) { this.store = store; // create or choose the appropriate event queue Session session = store.getSession(); String scope = session.getProperties().getProperty("mail.event.scope", "folder"); Executor executor = (Executor)session.getProperties().get("mail.event.executor"); if (scope.equalsIgnoreCase("application")) q = EventQueue.getApplicationEventQueue(executor); else if (scope.equalsIgnoreCase("session")) q = session.getEventQueue(); else if (scope.equalsIgnoreCase("store")) q = store.getEventQueue(); else // if (scope.equalsIgnoreCase("folder")) q = new EventQueue(executor); }
/** * Get the value of a boolean property. * Print out the value if logging is enabled. */ private final synchronized boolean getBoolProp(String prop) { prop = "mail." + name + "." + prop; boolean val = PropUtil.getBooleanProperty(session.getProperties(), prop, false); if (logger.isLoggable(Level.CONFIG)) logger.config(prop + ": " + val); return val; }
private void initStreams() throws IOException { boolean quote = PropUtil.getBooleanProperty(session.getProperties(), "mail.debug.quote", false); traceInput = new TraceInputStream(serverSocket.getInputStream(), traceLogger); traceInput.setQuote(quote); traceOutput = new TraceOutputStream(serverSocket.getOutputStream(), traceLogger); traceOutput.setQuote(quote); serverOutput = new BufferedOutputStream(traceOutput); serverInput = new BufferedInputStream(traceInput); lineInputStream = new LineInputStream(serverInput); }
final Properties sessionProperties = aSession.getProperties(); final String auth = sessionProperties.getProperty(EmailConstants.MAIL_SMTP_AUTH);
/** * Checks all of the settings if the caller requests a verify and a verify * was not performed yet and no verify is in progress. A verify is * performed on create because this handler may be at the end of a handler * chain and therefore may not see any log records until LogManager.reset() * is called and at that time all of the settings have been cleared. * @param session the current session or null. * @since JavaMail 1.4.4 */ private void verifySettings(final Session session) { try { if (session != null) { final Properties props = session.getProperties(); final Object check = props.put("verify", ""); if (check instanceof String) { String value = (String) check; //Perform the verify if needed. if (hasValue(value)) { verifySettings0(session, value); } } else { if (check != null) { //This call will fail. verifySettings0(session, check.getClass().toString()); } } } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.OPEN_FAILURE); } }
/** * Checks all of the settings if the caller requests a verify and a verify * was not performed yet and no verify is in progress. A verify is * performed on create because this handler may be at the end of a handler * chain and therefore may not see any log records until LogManager.reset() * is called and at that time all of the settings have been cleared. * @param session the current session or null. * @since JavaMail 1.4.4 */ private void verifySettings(final Session session) { try { if (session != null) { final Properties props = session.getProperties(); final Object check = props.put("verify", ""); if (check instanceof String) { String value = (String) check; //Perform the verify if needed. if (hasValue(value)) { verifySettings0(session, value); } } else { if (check != null) { //Pass some invalid string. verifySettings0(session, check.getClass().toString()); } } } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.OPEN_FAILURE); } }
String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { ntlm = new Ntlm(getNTLMDomain(), getLocalHost(), user, passwd, logger); flags = PropUtil.getIntProperty( session.getProperties(), "mail." + name + ".auth.ntlm.flags", 0); String type1 = ntlm.generateType1Msg(flags); return type1; }
@Override String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { ntlm = new Ntlm(getNTLMDomain(), getLocalHost(), user, passwd, logger); flags = PropUtil.getIntProperty( session.getProperties(), "mail." + name + ".auth.ntlm.flags", 0); String type1 = ntlm.generateType1Msg(flags); return type1; }
/** * Issue the <code>STARTTLS</code> command and switch the socket to * TLS mode if it succeeds. * * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected void startTLS() throws MessagingException { issueCommand("STARTTLS", 220); // it worked, now switch the socket into TLS mode try { serverSocket = SocketFetcher.startTLS(serverSocket, host, session.getProperties(), "mail." + name); initStreams(); } catch (IOException ioex) { closeConnection(); throw new MessagingException("Could not convert socket to TLS", ioex); } }
/** * Issue the <code>STARTTLS</code> command and switch the socket to * TLS mode if it succeeds. * * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected void startTLS() throws MessagingException { issueCommand("STARTTLS", 220); // it worked, now switch the socket into TLS mode try { serverSocket = SocketFetcher.startTLS(serverSocket, host, session.getProperties(), "mail." + name); initStreams(); } catch (IOException ioex) { closeConnection(); throw new MessagingException("Could not convert socket to TLS", ioex); } }
@Override protected synchronized boolean protocolConnect(String host, int portNum, String user, String passwd) throws MessagingException { // check for non-null values of host, password, user if (host == null || passwd == null || user == null) return false; // if port is not specified, set it to value of mail.pop3.port // property if it exists, otherwise default to 110 if (portNum == -1) portNum = PropUtil.getIntProperty(session.getProperties(), "mail." + name + ".port", -1); if (portNum == -1) portNum = defaultPort; this.host = host; this.portNum = portNum; this.user = user; this.passwd = passwd; try { port = getPort(null); } catch (EOFException eex) { throw new AuthenticationFailedException(eex.getMessage()); } catch (SocketConnectException scex) { throw new MailConnectException(scex); } catch (IOException ioex) { throw new MessagingException("Connect failed", ioex); } return true; }