コード例 #1
0
  /** Adds the {@link EnterXMPPAccountWizardPage}'s account data to the {@link XMPPAccountStore}. */
  private void addXMPPAccount() {

    if (!enterXMPPAccountWizardPage.isXMPPAccountCreated()) {
      JID jid = enterXMPPAccountWizardPage.getJID();

      String username = jid.getName();
      String password = enterXMPPAccountWizardPage.getPassword();
      String domain = jid.getDomain().toLowerCase();
      String server = enterXMPPAccountWizardPage.getServer();

      int port;

      if (enterXMPPAccountWizardPage.getPort().length() != 0)
        port = Integer.valueOf(enterXMPPAccountWizardPage.getPort());
      else port = 0;

      boolean useTLS = enterXMPPAccountWizardPage.isUsingTLS();
      boolean useSASL = enterXMPPAccountWizardPage.isUsingSASL();

      accountStore.createAccount(username, password, domain, server, port, useTLS, useSASL);
    }

    if (accountStore.getAllAccounts().size() == 1
        && store.getBoolean(PreferenceConstants.AUTO_CONNECT))
      ThreadUtils.runSafeAsync(
          "dpp-connect-demand",
          LOG,
          new Runnable() {
            @Override
            public void run() {
              connectionHandler.connect(accountStore.getActiveAccount(), false);
            }
          });
  }
コード例 #2
0
 /** @review runSafe OK */
 @Override
 public void run() {
   ThreadUtils.runSafeSync(
       LOG,
       new Runnable() {
         @Override
         public void run() {
           runDeleteAction();
         }
       });
 }
コード例 #3
0
  /**
   * Query the given {@linkplain JID} for the requested feature. The JID may be non resource
   * qualified in which case all presences belonging to that JID are queried.
   *
   * <p>All registered {@linkplain #addDiscoveryManagerListener(DiscoveryManagerListener) listeners}
   * will be notified about the result. The request may be performed asynchronously in which case
   * the caller must ensure that a listener has already been added to retrieve the results.
   *
   * <p><b>Please note the return value: <code>if(queryFeatureSupport(foo, bar, async)) ... </code>
   * is likely to produce a {@link NullPointerException NPE}.</b>
   *
   * @param jid {@link JID} to query support for
   * @param namespace the namespace of the feature
   * @param async if <code>true</code> the request will be performed asynchronously
   * @return <code>true</code> if the given JID supports the feature or <code>false</code> if the
   *     given JID does not support the feature or <code>null</code> if the query fails or is
   *     performed asynchronously
   */
  public Boolean queryFeatureSupport(final JID jid, final String namespace, boolean async) {
    checkJID(jid);

    if (!async) return queryFeatureSupport(jid, namespace);

    threadPoolExecutor.execute(
        ThreadUtils.wrapSafe(
            LOG,
            new Runnable() {
              @Override
              public void run() {
                queryFeatureSupport(jid, namespace);
              }
            }));

    return null;
  }