note.setText("Service name must be specified.");
return;
}
// Remove the server's domain name from the passed hostname
String servicename = servicehostname.replace("."+XMPPServer.getInstance().getServerInfo().getXMPPDomain(), "");
MultiUserChatService mucService;
mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(servicename);
if (mucService == null) {
note.addAttribute("type", "error");
note.setText("Invalid service name specified.");
return;
}
if (!mucService.isServiceEnabled()) {
note.addAttribute("type", "error");
note.setText("Multi user chat is disabled for specified service.");
return;
}
// Let's create the jid and check that they are a local user
String roomname = get(data, "roomname", 0);
if (roomname == null) {
note.addAttribute("type", "error");
note.setText("Room name must be specified.");
return;
}
JID admin = admins.iterator().next();
MUCRoom room;
try {
room = mucService.getChatRoom(roomname, admin);
}
catch (NotAllowedException e) {
note.addAttribute("type", "error");
note.setText("No permission to create rooms.");
return;