示例#1
0
  public void closeChatRoom() {
    // If already closed, don't bother.
    if (!active) {
      return;
    }

    super.closeChatRoom();

    // Remove info listener
    infoButton.removeActionListener(this);
    addToRosterButton.removeActionListener(this);

    // Send a cancel notification event on closing if listening.
    if (!sendNotification) {
      // send cancel
      SparkManager.getMessageEventManager()
          .sendCancelledNotification(getParticipantJID(), threadID);

      sendNotification = true;
    }

    SparkManager.getChatManager().removeChat(this);

    SparkManager.getConnection().removePacketListener(this);
    if (typingTimerTask != null) {
      TaskEngine.getInstance().cancelScheduledTask(typingTimerTask);
      typingTimerTask = null;
    }
    active = false;
  }
示例#2
0
  /**
   * The current SendField has been updated somehow.
   *
   * @param e - the DocumentEvent to respond to.
   */
  public void insertUpdate(DocumentEvent e) {
    checkForText(e);

    if (!sendTypingNotification) {
      return;
    }
    lastTypedCharTime = System.currentTimeMillis();

    // If the user pauses for more than two seconds, send out a new notice.
    if (sendNotification) {
      try {
        SparkManager.getMessageEventManager()
            .sendComposingNotification(getParticipantJID(), threadID);
        sendNotification = false;
      } catch (Exception exception) {
        Log.error("Error updating", exception);
      }
    }
  }