Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conference browser #870

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ConferenceRoomBrowser.createRoom() reformat
Signed-off-by: Sergey Ponomarev <[email protected]>
  • Loading branch information
stokito committed Aug 11, 2024
commit 80a0d781c227e60b00ad264c9d7e7a31a2343329
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart;
import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException;

Expand Down Expand Up @@ -834,56 +835,54 @@ private void enterRoom() {
* Create a new room based on room table selection.
*/
private void createRoom() {
RoomCreationDialog mucRoomDialog = new RoomCreationDialog();
final MultiUserChat groupChat = mucRoomDialog.createGroupChat(
SparkManager.getMainWindow(), serviceName);
LocalPreferences pref = SettingsManager.getLocalPreferences();

if (null != groupChat) {

// Join Room
try {
GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(groupChat);

Resourcepart nickname = pref.getNickname();
groupChat.create(nickname);
chatManager.getChatContainer().addChatRoom(room);
chatManager.getChatContainer().activateChatRoom(room);

// Send Form
FillableForm form = groupChat.getConfigurationForm().getFillableForm();
if (mucRoomDialog.isPasswordProtected()) {
String password = mucRoomDialog.getPassword();
room.setPassword(password);
form.setAnswer("muc#roomconfig_passwordprotectedroom", true);
form.setAnswer("muc#roomconfig_roomsecret", password);
}
form.setAnswer("muc#roomconfig_roomname",
mucRoomDialog.getRoomName());
form.setAnswer("muc#roomconfig_roomdesc",
mucRoomDialog.getRoomTopic());
RoomCreationDialog mucRoomDialog = new RoomCreationDialog();
final MultiUserChat groupChat = mucRoomDialog.createGroupChat(SparkManager.getMainWindow(), serviceName);
LocalPreferences pref = SettingsManager.getLocalPreferences();

if (mucRoomDialog.isPermanent()) {
form.setAnswer("muc#roomconfig_persistentroom", true);
}
if (groupChat == null) {
return;
}
// Join Room
try {
GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(groupChat);

Resourcepart nickname = pref.getNickname();
groupChat.create(nickname);
chatManager.getChatContainer().addChatRoom(room);
chatManager.getChatContainer().activateChatRoom(room);

// Send Form
FillableForm form = groupChat.getConfigurationForm().getFillableForm();
if (mucRoomDialog.isPasswordProtected()) {
String password = mucRoomDialog.getPassword();
room.setPassword(password);
form.setAnswer("muc#roomconfig_passwordprotectedroom", true);
form.setAnswer("muc#roomconfig_roomsecret", password);
}
form.setAnswer("muc#roomconfig_roomname", mucRoomDialog.getRoomName());
form.setAnswer("muc#roomconfig_roomdesc", mucRoomDialog.getRoomTopic());

List<String> owners = new ArrayList<>();
owners.add(SparkManager.getSessionManager().getUserBareAddress().toString());
form.setAnswer("muc#roomconfig_roomowners", owners);

// new DataFormDialog(groupChat, form);
groupChat.sendConfigurationForm(form);
addRoomToTable(groupChat.getRoom(), groupChat.getRoom().getLocalpart(), 1);
} catch (XMPPException | SmackException | InterruptedException e1) {
Log.error("Error creating new room.", e1);
UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
JOptionPane
.showMessageDialog(this,
Res.getString("message.room.creation.error"),
Res.getString("title.error"),
JOptionPane.ERROR_MESSAGE);
}
}
if (mucRoomDialog.isPermanent()) {
form.setAnswer("muc#roomconfig_persistentroom", true);
}

List<String> owners = new ArrayList<>(1);
owners.add(SparkManager.getSessionManager().getUserBareAddress().toString());
form.setAnswer("muc#roomconfig_roomowners", owners);

// new DataFormDialog(groupChat, form);
groupChat.sendConfigurationForm(form);
EntityBareJid groupChatRoom = groupChat.getRoom();
Localpart roomName = groupChatRoom.getLocalpart();
addRoomToTable(groupChatRoom, roomName, 1);
} catch (XMPPException | SmackException | InterruptedException e1) {
Log.error("Error creating new room.", e1);
UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
JOptionPane.showMessageDialog(this,
Res.getString("message.room.creation.error"),
Res.getString("title.error"),
JOptionPane.ERROR_MESSAGE);
}
}

/**
Expand Down