Search in sources :

Example 6 with ChatContainer

use of org.jivesoftware.spark.ui.ChatContainer in project Spark by igniterealtime.

the class UserInvitationPane method startFastpathChat.

private void startFastpathChat(String fullRoomJID, String roomName) {
    // Add to Chat window
    ChatManager chatManager = SparkManager.getChatManager();
    GroupChatRoom chatRoom;
    try {
        chatRoom = chatManager.getGroupChat(fullRoomJID);
        if (!chatRoom.isActive()) {
            // Remove old room, add new room.
            chatManager.removeChat(chatRoom);
            MultiUserChat chat = MultiUserChatManager.getInstanceFor(SparkManager.getConnection()).getMultiUserChat(fullRoomJID);
            chatRoom = new GroupChatRoom(chat);
        } else {
            // Already in the room, do not process invitation
            try {
                offer.reject();
            } catch (SmackException.NotConnectedException e) {
                Log.warning("Unable to reject offer " + offer, e);
            }
            return;
        }
    } catch (ChatNotFoundException e) {
        MultiUserChat chat = MultiUserChatManager.getInstanceFor(SparkManager.getConnection()).getMultiUserChat(fullRoomJID);
        chatRoom = new GroupChatRoom(chat);
    }
    chatRoom.getSplitPane().setDividerSize(5);
    chatRoom.getSplitPane().getRightComponent().setVisible(true);
    chatRoom.getBottomPanel().setVisible(true);
    chatRoom.getScrollPaneForTranscriptWindow().setVisible(true);
    chatRoom.getEditorBar().setVisible(true);
    chatRoom.getChatInputEditor().setEnabled(true);
    chatRoom.getToolBar().setVisible(true);
    chatRoom.getVerticalSlipPane().setDividerLocation(0.8);
    chatRoom.getSplitPane().setDividerLocation(0.6);
    try {
        chatRoom.setTabTitle(roomName);
        chatRoom.getConferenceRoomInfo().setNicknameChangeAllowed(false);
        chatRoom.getToolBar().setVisible(true);
        chatRoom.getEditorBar().setVisible(true);
        chatRoom.getChatInputEditor().setEnabled(true);
        ChatContainer chatContainer = SparkManager.getChatManager().getChatContainer();
        chatContainer.addChatRoom(chatRoom);
        FastpathPlugin.getLitWorkspace().addFastpathChatRoom(chatRoom, Workpane.RoomState.activeRoom);
        chatContainer.setChatRoomTitle(chatRoom, roomName);
        if (chatContainer.getActiveChatRoom() == chatRoom) {
            chatContainer.getChatFrame().setTitle(roomName);
        }
    } catch (Exception e) {
        Log.error(e);
    }
    ConferenceUtils.enterRoomOnSameThread(roomName, fullRoomJID, null);
    removeOwner(chatRoom.getMultiUserChat());
    FastpathPlugin.getLitWorkspace().checkForDecoration(chatRoom, offer.getSessionID());
    if (listener != null) {
        listener.yesOption();
        listener = null;
    }
}
Also used : GroupChatRoom(org.jivesoftware.spark.ui.rooms.GroupChatRoom) ChatContainer(org.jivesoftware.spark.ui.ChatContainer) MultiUserChat(org.jivesoftware.smackx.muc.MultiUserChat) ChatNotFoundException(org.jivesoftware.spark.ChatNotFoundException) SmackException(org.jivesoftware.smack.SmackException) ChatManager(org.jivesoftware.spark.ChatManager) MultiUserChatManager(org.jivesoftware.smackx.muc.MultiUserChatManager) SmackException(org.jivesoftware.smack.SmackException) XMPPException(org.jivesoftware.smack.XMPPException) ChatNotFoundException(org.jivesoftware.spark.ChatNotFoundException)

Aggregations

ChatContainer (org.jivesoftware.spark.ui.ChatContainer)6 ChatManager (org.jivesoftware.spark.ChatManager)5 ChatRoom (org.jivesoftware.spark.ui.ChatRoom)4 ChatRoomNotFoundException (org.jivesoftware.spark.ui.ChatRoomNotFoundException)3 ChatRoomImpl (org.jivesoftware.spark.ui.rooms.ChatRoomImpl)3 File (java.io.File)1 TableColumn (javax.swing.table.TableColumn)1 SmackException (org.jivesoftware.smack.SmackException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 Message (org.jivesoftware.smack.packet.Message)1 DelayInformation (org.jivesoftware.smackx.delay.packet.DelayInformation)1 MultiUserChat (org.jivesoftware.smackx.muc.MultiUserChat)1 MultiUserChatManager (org.jivesoftware.smackx.muc.MultiUserChatManager)1 ChatNotFoundException (org.jivesoftware.spark.ChatNotFoundException)1 SparkTab (org.jivesoftware.spark.component.tabbedPane.SparkTab)1 MessageListener (org.jivesoftware.spark.ui.MessageListener)1 GroupChatRoom (org.jivesoftware.spark.ui.rooms.GroupChatRoom)1 SwingWorker (org.jivesoftware.spark.util.SwingWorker)1 SoundPreference (org.jivesoftware.sparkimpl.preference.sounds.SoundPreference)1 SoundPreferences (org.jivesoftware.sparkimpl.preference.sounds.SoundPreferences)1