/** Mutes or unmutes the associated <tt>Call</tt> upon clicking this button. */
  public void toggleMute() {
    if (muteRunner == null) {
      muteRunner = new Thread(this, getToolTipText());
      muteRunner.setDaemon(true);

      setEnabled(false);
      muteRunner.start();
    }
  }
  /**
   * Creates a shell channel to the remote machine a new jsch session is also created if the current
   * one is invalid
   *
   * @param sshContact the contact of the remote machine
   * @param firstMessage the first message
   */
  public void connectShell(final ContactSSH sshContact, final Message firstMessage) {
    sshContact.setConnectionInProgress(true);

    final UIService uiService = this.uiService;

    final Thread newConnection =
        new Thread(
            (new Runnable() {
              public void run() {
                OperationSetPersistentPresenceSSHImpl persistentPresence =
                    (OperationSetPersistentPresenceSSHImpl)
                        sshContact.getParentPresenceOperationSet();

                persistentPresence.changeContactPresenceStatus(
                    sshContact, SSHStatusEnum.CONNECTING);

                try {
                  if (!isSessionValid(sshContact)) createSSHSessionAndLogin(sshContact);

                  createShellChannel(sshContact);

                  // initalizing the reader and writers of ssh contact

                  persistentPresence.changeContactPresenceStatus(
                      sshContact, SSHStatusEnum.CONNECTED);

                  showWelcomeMessage(sshContact);

                  sshContact.setMessageType(sshContact.CONVERSATION_MESSAGE_RECEIVED);

                  sshContact.setConnectionInProgress(false);

                  Thread.sleep(1500);

                  sshContact.setCommandSent(true);

                  basicInstantMessaging.sendInstantMessage(sshContact, firstMessage);
                }
                // rigoruos Exception Checking in future
                catch (Exception ex) {
                  persistentPresence.changeContactPresenceStatus(
                      sshContact, SSHStatusEnum.NOT_AVAILABLE);

                  ex.printStackTrace();
                } finally {
                  sshContact.setConnectionInProgress(false);
                }
              }
            }));

    newConnection.start();
  }
Example #3
0
    void start() {
      if (timeoutThread != null) {
        throw new IllegalStateException();
      }

      timeoutThread =
          new Thread(
              new Runnable() {
                @Override
                public void run() {
                  expireLoop();
                }
              },
              "FocusExpireThread");

      enabled = true;

      timeoutThread.start();
    }
  /**
   * Initializes the server stored list. Synchronize server stored groups and contacts with the
   * local groups and contacts.
   */
  @Override
  public void init() {
    try {
      SipAccountIDImpl accountID = (SipAccountIDImpl) sipProvider.getAccountID();

      if (!accountID.isXiVOEnable()) return;

      boolean useSipCredentials = accountID.isClistOptionUseSipCredentials();

      String serverAddress = accountID.getClistOptionServerUri();
      String username = accountID.getAccountPropertyString(ProtocolProviderFactory.USER_ID);
      Address userAddress = sipProvider.parseAddressString(username);

      if (useSipCredentials) {
        username = ((SipUri) userAddress.getURI()).getUser();
      } else {
        username = accountID.getClistOptionUser();
      }

      try {
        connect(serverAddress);
      } catch (Throwable ex) {
        showError(ex, null, null);
        logger.error("Error connecting to server", ex);
        return;
      }

      Thread thread = new Thread(this, this.getClass().getName());
      thread.setDaemon(true);
      thread.start();

      if (!login(username)) {
        showError(null, null, "Unauthorized. Cannot login.");
        logger.error("Cannot login.");
        return;
      }
    } catch (Throwable t) {
      logger.error("Error init clist from xivo server");
    }
  }
Example #5
0
  /**
   * Creates new call to given <tt>destination</tt> using selected <tt>provider</tt>.
   *
   * @param context the android context
   * @param destination target callee name.
   * @param provider the provider that will be used to make a call.
   */
  public static void createCall(
      final Context context, final String destination, final ProtocolProviderService provider) {
    if (createCallThread != null) {
      logger.warn("Another call is already being created");
      return;
    } else if (CallManager.getActiveCallsCount() > 0) {
      logger.warn("Another call is in progress");
      return;
    }

    final long dialogId =
        ProgressDialogFragment.showProgressDialog(
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL),
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL_MSG, destination));

    createCallThread =
        new Thread("Create call thread") {
          public void run() {
            try {
              CallManager.createCall(provider, destination);
            } catch (Throwable t) {
              logger.error("Error creating the call: " + t.getMessage(), t);
              AndroidUtils.showAlertDialog(
                  context, context.getString(R.string.service_gui_ERROR), t.getMessage());
            } finally {
              if (DialogActivity.waitForDialogOpened(dialogId)) {
                DialogActivity.closeDialog(JitsiApplication.getGlobalContext(), dialogId);
              } else {
                logger.error("Failed to wait for the dialog: " + dialogId);
              }
              createCallThread = null;
            }
          }
        };

    createCallThread.start();
  }