public void processBye(RequestEvent requestEvent, ServerTransaction serverTransaction) {
    try {
      logger.debug("DEBUG: IMByeProcessing, Processing BYE in progress...");

      Request request = requestEvent.getRequest();

      MessageFactory messageFactory = imUA.getMessageFactory();
      InstantMessagingGUI instantMessagingGUI = imUA.getInstantMessagingGUI();
      ListenerInstantMessaging listenerInstantMessaging =
          instantMessagingGUI.getListenerInstantMessaging();
      ChatSessionManager chatSessionManager = listenerInstantMessaging.getChatSessionManager();
      String buddy = IMUtilities.getKey(request, "From");
      if (chatSessionManager.hasAlreadyChatSession(buddy)) {
        chatSessionManager.removeChatSession(buddy);
        // chatSession.setExitedSession(true,"Your contact has exited
        // the session");
      } else {
        logger.debug("DEBUG: IMByeProcessing, processBye(), no active chatSession");
      }

      // Send an OK
      Response response = messageFactory.createResponse(Response.OK, request);
      serverTransaction.sendResponse(response);
      logger.debug("DEBUG: IMByeProcessing, processBye(), OK replied to the BYE");

      logger.debug("DEBUG: IMByeProcessing, Processing BYE completed...");
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public void submitButtonActionPerformed(ActionEvent evt) {
    String text = "";

    IMUserAgent imUA = imGUI.getInstantMessagingUserAgent();
    IMRegisterProcessing imRegisterProcessing = imUA.getIMRegisterProcessing();
    if (!imRegisterProcessing.isRegistered()) {

      String temp = outboundProxyAddressTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.outboundProxyAddress=" + temp + "\n";

      temp = outboundProxyPortTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.outboundProxyPort=" + temp + "\n";

      temp = registrarAddressTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.registrarAddress=" + temp + "\n";

      temp = registrarPortTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.registrarPort=" + temp + "\n";

      temp = imAddressTextField.getText();
      if (temp != null && !temp.trim().equals("")) text += "examples.im.imAddress=" + temp + "\n";

      temp = imPortTextField.getText();
      if (temp != null && !temp.trim().equals("")) text += "examples.im.imPort=" + temp + "\n";

      temp = imProtocolTextField.getText();
      if (temp != null && !temp.trim().equals("")) text += "examples.im.imProtocol=" + temp + "\n";

      temp = outputFileTextField.getText();
      if (temp != null && !temp.trim().equals("")) {
        text += "examples.im.outputFile=" + temp + "\n";

        DebugIM.setDebugFile(temp);
      } else DebugIM.setDebugFile(null);

      temp = buddiesFileTextField.getText();
      if (temp != null && !temp.trim().equals("")) text += "examples.im.buddiesFile=" + temp + "\n";

      temp = authenticationFileTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.authenticationFile=" + temp + "\n";

      temp = defaultRouterTextField.getText();
      if (temp != null && !temp.trim().equals(""))
        text += "examples.im.defaultRouter=" + temp + "\n";

      temp = imGUI.getLocalSipURLTextField().getText();
      if (temp != null && !temp.trim().equals("")) text += "examples.im.localSipURL=" + temp + "\n";

      String propertiesFile = imGUI.getPropertiesFile();
      if (propertiesFile == null)
        DebugIM.println(
            "DebugIM, unable to write the "
                + "properties, specify a properties file when you start the client");
      else {
        IMUtilities.writeFile(propertiesFile, text);
        imGUI.restart();
      }
      this.setVisible(false);

    } else {
      new AlertInstantMessaging(
          "You must sign out from the registrar before changing something!!!",
          JOptionPane.ERROR_MESSAGE);
    }
  }