diff --git a/.gitignore b/.gitignore index bc67cdb..27f29d8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules trash .DS_Store *.sublime-* -yarn.lock \ No newline at end of file +yarn.lock +.vscode/ \ No newline at end of file diff --git a/RoomManager.js b/RoomManager.js index f85bb76..61062ea 100644 --- a/RoomManager.js +++ b/RoomManager.js @@ -218,16 +218,26 @@ RoomManager.prototype.renameRoom = function (client,cfg) { } var oldRoomName = client.room.name; var newRoomName = cfg.roomName; + if (newRoomName === oldRoomName) { + return; + } if (!errMsg) { errMsg = this.checkRoomName(newRoomName); } var room; + if (!errMsg) { + if (newRoomName in this.roomMap) { + errMsg = 'ROOM_ALREADY_EXISTS'; + client.room.update(); + } + } if (!errMsg) { room = this.roomMap[oldRoomName]; if (!room) { errMsg = 'ROOM_DOES_NOT_EXIST'; } else if (client.getPosition() !== 'host') { errMsg = 'YOU_ARE_NOT_ROOM_HOST'; + client.room.update(); } } if (errMsg) { diff --git a/webxoss-client b/webxoss-client index 51a710f..36727dd 160000 --- a/webxoss-client +++ b/webxoss-client @@ -1 +1 @@ -Subproject commit 51a710f84c2931e55ca71009ad469468b5662863 +Subproject commit 36727dd62e19545ca9a0abcc25124e7858c788aa