/** * Leaves the given chat room. * * @param chatRoomWrapper the chat room to leave. * @return <tt>ChatRoomWrapper</tt> instance associated with the chat room. */ public ChatRoomWrapper leaveChatRoom(ChatRoomWrapper chatRoomWrapper) { ChatRoom chatRoom = chatRoomWrapper.getChatRoom(); if (chatRoom == null) { ResourceManagementService resources = MUCActivator.getResources(); MUCActivator.getAlertUIService() .showAlertDialog( resources.getI18NString("service.gui.WARNING"), resources.getI18NString("service.gui.CHAT_ROOM_LEAVE_NOT_CONNECTED")); return null; } if (chatRoom.isJoined()) chatRoom.leave(); ChatRoomWrapper existChatRoomWrapper = chatRoomList.findChatRoomWrapperFromChatRoom(chatRoom); if (existChatRoomWrapper == null) return null; // We save the choice of the user, before the chat room is really // joined, because even the join fails we want the next time when // we login to join this chat room automatically. ConfigurationUtils.updateChatRoomStatus( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), GlobalStatusEnum.OFFLINE_STATUS); return existChatRoomWrapper; }