--- a/gameServer/HWProtoInRoomState.hs Sat Dec 14 21:16:20 2013 +0400
+++ b/gameServer/HWProtoInRoomState.hs Tue Dec 17 00:02:52 2013 +0400
@@ -31,7 +31,11 @@
| otherwise = do
chans <- roomOthersChans
cl <- thisClient
- if isMaster cl then
+ rm <- thisRoom
+
+ if isSpecial rm then
+ return [Warning $ loc "Restricted"]
+ else if isMaster cl then
return [
ModifyRoom f,
AnswerClients chans ("CFG" : paramName : paramStrs)]
@@ -43,6 +47,7 @@
else
r{params = Map.insert paramName paramStrs (params r)}
+
handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo)
| length hhsInfo /= 16 = return [ProtocolError $ loc "Corrupted hedgehogs info"]
| otherwise = do
@@ -290,11 +295,14 @@
if illegalName newName then
[Warning $ loc "Illegal room name"]
else
+ if isSpecial rm then
+ [Warning $ loc "Restricted"]
+ else
if isJust $ find (\r -> newName == name r) rs then
[Warning $ loc "Room with such name already exists"]
else
[ModifyRoom roomUpdate,
- AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (nick cl) (roomUpdate rm))]
+ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (clientProto cl) (nick cl) (roomUpdate rm))]
where
roomUpdate r = r{name = newName}
@@ -323,6 +331,7 @@
maybeClientId <- clientByNick newAdmin
master <- liftM isMaster thisClient
serverAdmin <- liftM isAdministrator thisClient
+ thisRoomMasterId <- liftM masterID thisRoom
let newAdminId = fromJust maybeClientId
let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
return
@@ -330,6 +339,7 @@
(master || serverAdmin)
&& isJust maybeClientId
&& ((newAdminId /= thisClientId) || (serverAdmin && not master))
+ && (Just newAdminId /= thisRoomMasterId)
&& sameRoom]
@@ -360,6 +370,19 @@
s <- roomClientsChans
return [AnswerClients s ["CHAT", n, B.unwords $ "/rnd" : rs], Random s rs]
+handleCmd_inRoom ["FIX"] = do
+ cl <- thisClient
+ return [ModifyRoom (\r -> r{isSpecial = True}) | isAdministrator cl]
+
+handleCmd_inRoom ["UNFIX"] = do
+ cl <- thisClient
+ return [ModifyRoom (\r -> r{isSpecial = False}) | isAdministrator cl]
+
+handleCmd_inRoom ["GREETING", msg] = do
+ cl <- thisClient
+ rm <- thisRoom
+ return [ModifyRoom (\r -> r{greeting = msg}) | isAdministrator cl || (isMaster cl && (not $ isSpecial rm))]
+
handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)
handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"]