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;
}
}
Aggregations