FileDocCategorySizeDatePackage
Pop3Store.javaAPI DocAndroid 1.5 API37605Wed May 06 22:42:46 BST 2009com.android.email.mail.store

Pop3Store

public class Pop3Store extends com.android.email.mail.Store

Fields Summary
private static boolean
DEBUG_FORCE_SINGLE_LINE_UIDL
private static boolean
DEBUG_LOG_RAW_STREAM
private static final com.android.email.mail.Flag[]
PERMANENT_FLAGS
private com.android.email.mail.Transport
mTransport
private String
mUsername
private String
mPassword
private HashMap
mFolders
Constructors Summary
public Pop3Store(String _uri)
pop3://user:password@server:port CONNECTION_SECURITY_NONE pop3+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL pop3+tls+://user:password@server:port CONNECTION_SECURITY_TLS_REQUIRED pop3+ssl+://user:password@server:port CONNECTION_SECURITY_SSL_REQUIRED pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL

param
_uri


//    /**
//     * Detected latency, used for usage scaling.
//     * Usage scaling occurs when it is neccesary to get information about
//     * messages that could result in large data loads. This value allows
//     * the code that loads this data to decide between using large downloads
//     * (high latency) or multiple round trips (low latency) to accomplish
//     * the same thing.
//     * Default is Integer.MAX_VALUE implying massive latency so that the large
//     * download method is used by default until latency data is collected.
//     */
//    private int mLatencyMs = Integer.MAX_VALUE;
//
//    /**
//     * Detected throughput, used for usage scaling.
//     * Usage scaling occurs when it is neccesary to get information about
//     * messages that could result in large data loads. This value allows
//     * the code that loads this data to decide between using large downloads
//     * (high latency) or multiple round trips (low latency) to accomplish
//     * the same thing.
//     * Default is Integer.MAX_VALUE implying massive bandwidth so that the
//     * large download method is used by default until latency data is
//     * collected.
//     */
//    private int mThroughputKbS = Integer.MAX_VALUE;

                     
         
        URI uri;
        try {
            uri = new URI(_uri);
        } catch (URISyntaxException use) {
            throw new MessagingException("Invalid Pop3Store URI", use);
        }

        String scheme = uri.getScheme();
        int connectionSecurity = Transport.CONNECTION_SECURITY_NONE;
        int defaultPort = -1;
        if (scheme.equals(STORE_SCHEME_POP3)) {
            connectionSecurity = Transport.CONNECTION_SECURITY_NONE;
            defaultPort = 110;
        } else if (scheme.equals(STORE_SCHEME_POP3 + "+tls")) {
            connectionSecurity = Transport.CONNECTION_SECURITY_TLS_OPTIONAL;
            defaultPort = 110;
        } else if (scheme.equals(STORE_SCHEME_POP3 + "+tls+")) {
            connectionSecurity = Transport.CONNECTION_SECURITY_TLS_REQUIRED;
            defaultPort = 110;
        } else if (scheme.equals(STORE_SCHEME_POP3 + "+ssl+")) {
            connectionSecurity = Transport.CONNECTION_SECURITY_SSL_REQUIRED;
            defaultPort = 995;
        } else if (scheme.equals(STORE_SCHEME_POP3 + "+ssl")) {
            connectionSecurity = Transport.CONNECTION_SECURITY_SSL_OPTIONAL;
            defaultPort = 995;
        } else {
            throw new MessagingException("Unsupported protocol");
        }
        
        mTransport = new MailTransport("POP3");
        mTransport.setUri(uri, defaultPort);
        mTransport.setSecurity(connectionSecurity);

        String[] userInfoParts = mTransport.getUserInfoParts();
        if (userInfoParts != null) {
            mUsername = userInfoParts[0];
            if (userInfoParts.length > 1) {
                mPassword = userInfoParts[1];
            }
        }
    
Methods Summary
public voidcheckSettings()
Used by account setup to test if an account's settings are appropriate. The definition of "checked" here is simply, can you log into the account and does it meet some minimum set of feature requirements?

throws
MessagingException if there was some problem with the account

        Pop3Folder folder = new Pop3Folder("INBOX");
        try {
            folder.open(OpenMode.READ_WRITE);
            folder.checkSettings();
        } finally {
            folder.close(false);    // false == don't expunge anything
        }
    
public com.android.email.mail.FoldergetFolder(java.lang.String name)

        Folder folder = mFolders.get(name);
        if (folder == null) {
            folder = new Pop3Folder(name);
            mFolders.put(folder.getName(), folder);
        }
        return folder;
    
public com.android.email.mail.Folder[]getPersonalNamespaces()

        return new Folder[] {
            getFolder("INBOX"),
        };
    
voidsetTransport(com.android.email.mail.Transport testTransport)
For testing only. Injects a different transport. The transport should already be set up and ready to use. Do not use for real code.

param
testTransport The Transport to inject and use for all future communication.

        mTransport = testTransport;