Пример #1
0
 public void setArchiveMode(String account, ArchiveMode archiveMode) {
   AccountItem accountItem = AccountManager.getInstance().getAccount(account);
   AccountManager.getInstance()
       .updateAccount(
           account,
           accountItem.getConnectionSettings().isCustom(),
           accountItem.getConnectionSettings().getHost(),
           accountItem.getConnectionSettings().getPort(),
           accountItem.getConnectionSettings().getServerName(),
           accountItem.getConnectionSettings().getUserName(),
           accountItem.isStorePassword(),
           accountItem.getConnectionSettings().getPassword(),
           accountItem.getConnectionSettings().getResource(),
           accountItem.getPriority(),
           accountItem.isEnabled(),
           accountItem.getConnectionSettings().isSaslEnabled(),
           accountItem.getConnectionSettings().getTlsMode(),
           accountItem.getConnectionSettings().useCompression(),
           accountItem.getConnectionSettings().getProxyType(),
           accountItem.getConnectionSettings().getProxyHost(),
           accountItem.getConnectionSettings().getProxyPort(),
           accountItem.getConnectionSettings().getProxyUser(),
           accountItem.getConnectionSettings().getProxyPassword(),
           accountItem.isSyncable(),
           archiveMode);
 }
Пример #2
0
 /**
  * Save account item to database.
  *
  * @param accountItem
  */
 void requestToWriteAccount(final AccountItem accountItem) {
   final AccountProtocol protocol = accountItem.getConnectionSettings().getProtocol();
   final boolean custom = accountItem.getConnectionSettings().isCustom();
   final String host = accountItem.getConnectionSettings().getHost();
   final int port = accountItem.getConnectionSettings().getPort();
   final String serverName = accountItem.getConnectionSettings().getServerName();
   final String userName = accountItem.getConnectionSettings().getUserName();
   final String resource = accountItem.getConnectionSettings().getResource();
   final boolean storePassword = accountItem.isStorePassword();
   final String password = accountItem.getConnectionSettings().getPassword();
   final int colorIndex = accountItem.getColorIndex();
   final int priority = accountItem.getPriority();
   final StatusMode statusMode = accountItem.getRawStatusMode();
   final String statusText = accountItem.getStatusText();
   final boolean enabled = accountItem.isEnabled();
   final boolean saslEnabled = accountItem.getConnectionSettings().isSaslEnabled();
   final TLSMode tlsMode = accountItem.getConnectionSettings().getTlsMode();
   final boolean compression = accountItem.getConnectionSettings().useCompression();
   final ProxyType proxyType = accountItem.getConnectionSettings().getProxyType();
   final String proxyHost = accountItem.getConnectionSettings().getProxyHost();
   final int proxyPort = accountItem.getConnectionSettings().getProxyPort();
   final String proxyUser = accountItem.getConnectionSettings().getProxyUser();
   final String proxyPassword = accountItem.getConnectionSettings().getProxyPassword();
   final boolean syncable = accountItem.isSyncable();
   final KeyPair keyPair = accountItem.getKeyPair();
   final Date lastSync = accountItem.getLastSync();
   final ArchiveMode archiveMode = accountItem.getArchiveMode();
   Application.getInstance()
       .runInBackground(
           new Runnable() {
             @Override
             public void run() {
               accountItem.setId(
                   AccountTable.getInstance()
                       .write(
                           accountItem.getId(),
                           protocol,
                           custom,
                           host,
                           port,
                           serverName,
                           userName,
                           resource,
                           storePassword,
                           password,
                           colorIndex,
                           priority,
                           statusMode,
                           statusText,
                           enabled,
                           saslEnabled,
                           tlsMode,
                           compression,
                           proxyType,
                           proxyHost,
                           proxyPort,
                           proxyUser,
                           proxyPassword,
                           syncable,
                           keyPair,
                           lastSync,
                           archiveMode));
             }
           });
 }