@Override
      public void run() {
        ChatRoom chatRoom = chatRoomWrapper.getChatRoom();

        if (chatRoom != null) {
          ChatRoomWrapper leavedRoomWrapped =
              MUCActivator.getMUCService().leaveChatRoom(chatRoomWrapper);
          if (leavedRoomWrapped != null)
            MUCActivator.getUIService().closeChatRoomWindow(leavedRoomWrapped);
        }

        MUCActivator.getUIService().closeChatRoomWindow(chatRoomWrapper);

        MUCActivator.getMUCService().removeChatRoom(chatRoomWrapper);
      }
 @Override
 public void run() {
   MUCActivator.getUIService()
       .showChatRoomAutoOpenConfigDialog(
           chatRoomWrapper.getParentProvider().getProtocolProvider(),
           chatRoomWrapper.getChatRoomID());
 }
示例#3
0
 /**
  * Destroys the given <tt>ChatRoom</tt> from the list of all chat rooms.
  *
  * @param chatRoomWrapper the <tt>ChatRoomWrapper</tt> to be destroyed.
  * @param reason the reason for destroying.
  * @param alternateAddress the alternate address.
  */
 public void destroyChatRoom(
     ChatRoomWrapper chatRoomWrapper, String reason, String alternateAddress) {
   if (chatRoomWrapper.getChatRoom().destroy(reason, alternateAddress)) {
     MUCActivator.getUIService().closeChatRoomWindow(chatRoomWrapper);
     chatRoomList.removeChatRoom(chatRoomWrapper);
   } else {
     // if we leave a chat room which is not persistent
     // the room can be destroyed on the server, and error is returned
     // when we try to destroy it not-authorized(401)
     if (!chatRoomWrapper.getChatRoom().isPersistent()
         && !chatRoomWrapper.getChatRoom().isJoined()) {
       chatRoomList.removeChatRoom(chatRoomWrapper);
     }
   }
 }
示例#4
0
  /**
   * Opens a chat window for the chat room.
   *
   * @param room the chat room.
   */
  public void openChatRoom(ChatRoomWrapper room) {
    if (room.getChatRoom() == null) {
      room =
          createChatRoom(
              room.getChatRoomName(),
              room.getParentProvider().getProtocolProvider(),
              new ArrayList<String>(),
              "",
              false,
              false,
              true);

      // leave the chatroom because getChatRoom().isJoined() returns true
      // otherwise
      if (room.getChatRoom().isJoined()) room.getChatRoom().leave();
    }

    if (!room.getChatRoom().isJoined()) {
      String savedNick =
          ConfigurationUtils.getChatRoomProperty(
              room.getParentProvider().getProtocolProvider(), room.getChatRoomID(), "userNickName");
      String subject = null;

      if (savedNick == null) {
        String[] joinOptions =
            ChatRoomJoinOptionsDialog.getJoinOptions(
                room.getParentProvider().getProtocolProvider(),
                room.getChatRoomID(),
                getDefaultNickname(room.getParentProvider().getProtocolProvider()));
        savedNick = joinOptions[0];
        subject = joinOptions[1];
      }

      if (savedNick != null) {
        joinChatRoom(room, savedNick, null, subject);
      } else return;
    }

    MUCActivator.getUIService().openChatRoomWindow(room);
  }