Commit afd41707 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed to return not-allowed error when room creation failes due to permissions restrictions. JM-456

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3036 b35dd754-fafc-0310-a699-88a17e54d16e
parent bfbbb8e3
......@@ -201,9 +201,9 @@ public interface MultiUserChatServer extends Component {
* @param roomName Name of the room to get.
* @param userjid The user's normal jid, not the chat nickname jid.
* @return The chatroom for the given name.
* @throws UnauthorizedException If the caller doesn't have permission to create a new room.
* @throws NotAllowedException If the caller doesn't have permission to create a new room.
*/
MUCRoom getChatRoom(String roomName, JID userjid) throws UnauthorizedException;
MUCRoom getChatRoom(String roomName, JID userjid) throws NotAllowedException;
/**
* Obtains a chatroom by name. If the chatroom does not exists then null will be returned.
......
......@@ -420,6 +420,9 @@ public class MUCUserImpl implements MUCUser {
catch (NotAcceptableException e) {
sendErrorPacket(packet, PacketError.Condition.not_acceptable);
}
catch (NotAllowedException e) {
sendErrorPacket(packet, PacketError.Condition.not_allowed);
}
}
else {
// TODO: send error message to user (can't send presence to group you
......
......@@ -385,7 +385,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
}
}
public MUCRoom getChatRoom(String roomName, JID userjid) throws UnauthorizedException {
public MUCRoom getChatRoom(String roomName, JID userjid) throws NotAllowedException {
MUCRoom room = null;
synchronized (roomName.intern()) {
room = rooms.get(roomName.toLowerCase());
......@@ -407,7 +407,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
if (!allowedToCreate.contains(userjid.toBareJID())) {
// The user is not in the list of allowed JIDs to create a room so raise
// an exception
throw new UnauthorizedException();
throw new NotAllowedException();
}
}
room.addFirstOwner(userjid.toBareJID());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment