Android Open Source - inotes Imap Session






From Project

Back to project page inotes.

License

The source code is released under:

GNU General Public License

If you think the Android project inotes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codeminders.inotes.imap;
/*  w ww  .  jav a 2 s. co  m*/
import javax.mail.Session;
import java.util.Properties;

public class ImapSession {
    protected String imapHost;
    protected String imapPort;
    private boolean useSSL;
    private Session session;

    public ImapSession(String imapHost, String imapPort, boolean useSSL) {
        this.imapHost = imapHost;
        this.imapPort = imapPort;
        this.useSSL = useSSL;
    }

    public Session getSession() {
        if (session != null) {
            return session;
        }
        Properties props = new Properties();
        if (useSSL) {
            props.setProperty("mail.store.protocol", "imaps");
            props.setProperty("mail.imaps.host", imapHost);
            props.setProperty("mail.imaps.port", imapPort);
            props.setProperty("mail.imaps.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.setProperty("mail.imaps.socketFactory.fallback", "false");
            session = Session.getInstance(props);
        } else {
            props.setProperty("mail.store.protocol", "imap");
            props.setProperty("mail.imap.host", imapHost);
            props.setProperty("mail.imap.port", imapPort);
            session = Session.getDefaultInstance(props);
        }
        return session;
    }

    public String getProtocol() {
        if (session != null) {
            return session.getProperty("mail.store.protocol");
        } else {
            return null;
        }
    }

}




Java Source Code List

com.codeminders.inotes.AccountReceiver.java
com.codeminders.inotes.Constants.java
com.codeminders.inotes.Utils.java
com.codeminders.inotes.auth.AuthenticationService.java
com.codeminders.inotes.auth.AuthenticatorActivity.java
com.codeminders.inotes.auth.Authenticator.java
com.codeminders.inotes.auth.ConfigurationActivity.java
com.codeminders.inotes.db.DBCreator.java
com.codeminders.inotes.db.DBManager.java
com.codeminders.inotes.db.DBUpgradeHelper.java
com.codeminders.inotes.imap.HeaderUtils.java
com.codeminders.inotes.imap.ImapService.java
com.codeminders.inotes.imap.ImapSession.java
com.codeminders.inotes.model.AccountInfo.java
com.codeminders.inotes.model.Note.java
com.codeminders.inotes.sync.NotesProvider.java
com.codeminders.inotes.sync.NotesSyncService.java
com.codeminders.inotes.sync.SyncAccountInfo.java
com.codeminders.inotes.sync.SyncAdapter.java
com.codeminders.inotes.sync.SyncAllAccountsInfo.java
com.codeminders.inotes.sync.SyncHelper.java
com.codeminders.inotes.sync.SyncInfo.java
com.codeminders.inotes.ui.AccountsListActivity.java
com.codeminders.inotes.ui.LinedEditText.java
com.codeminders.inotes.ui.NoteEditorActivity.java
com.codeminders.inotes.ui.NotesListActivity.java
com.codeminders.inotes.ui.SettingsActivity.java