Search in sources :

Example 1 with ProxyType

use of com.xabber.android.data.connection.ProxyType in project xabber-android by redsolution.

the class AccountEditorFragment method setValues.

@Override
protected boolean setValues(Map<String, Object> source, Map<String, Object> result) {
    if (listener == null) {
        return false;
    }
    ProxyType proxyType = ProxyType.values()[getInt(result, R.string.account_proxy_type_key)];
    if (proxyType == ProxyType.orbot && !OrbotHelper.isOrbotInstalled()) {
        listener.showOrbotDialog();
        return false;
    }
    DomainBareJid serverName;
    Localpart userName;
    Resourcepart resource;
    try {
        serverName = JidCreate.domainBareFrom(getString(result, R.string.account_server_key).trim());
        userName = Localpart.from(getString(result, R.string.account_username_key).trim());
        resource = Resourcepart.from(getString(result, R.string.account_resource_key).trim());
    } catch (XmppStringprepException e) {
        LogManager.exception(this, e);
        return false;
    }
    AccountManager.getInstance().updateAccount(listener.getAccount(), getBoolean(result, R.string.account_custom_key), getString(result, R.string.account_host_key), getInt(result, R.string.account_port_key), serverName, userName, getBoolean(result, R.string.account_store_password_key), getString(result, R.string.account_password_key), "", resource, getInt(result, R.string.account_priority_key), getBoolean(result, R.string.account_enabled_key), getBoolean(result, R.string.account_sasl_key), TLSMode.values()[getInt(result, R.string.account_tls_mode_key)], getBoolean(result, R.string.account_compression_key), proxyType, getString(result, R.string.account_proxy_host_key), getInt(result, R.string.account_proxy_port_key), getString(result, R.string.account_proxy_user_key), getString(result, R.string.account_proxy_password_key), getBoolean(result, R.string.account_syncable_key), ArchiveMode.values()[getInt(result, R.string.account_archive_mode_key)], getInt(result, R.string.account_color_key));
    return true;
}
Also used : Localpart(org.jxmpp.jid.parts.Localpart) ProxyType(com.xabber.android.data.connection.ProxyType) XmppStringprepException(org.jxmpp.stringprep.XmppStringprepException) DomainBareJid(org.jxmpp.jid.DomainBareJid) Resourcepart(org.jxmpp.jid.parts.Resourcepart)

Aggregations

ProxyType (com.xabber.android.data.connection.ProxyType)1 DomainBareJid (org.jxmpp.jid.DomainBareJid)1 Localpart (org.jxmpp.jid.parts.Localpart)1 Resourcepart (org.jxmpp.jid.parts.Resourcepart)1 XmppStringprepException (org.jxmpp.stringprep.XmppStringprepException)1