netserver/HWProto.hs
changeset 1483 89e24edb6020
parent 1478 8bfb417d165e
child 1491 0b1f44751509
equal deleted inserted replaced
1482:8af42b3f93d2 1483:89e24edb6020
    23 		nicks = filter (not . null) $ map nick clients
    23 		nicks = filter (not . null) $ map nick clients
    24 		
    24 		
    25 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])]
    25 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])]
    26 answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])]
    26 answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])]
    27 answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])]
    27 answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])]
       
    28 answerErrorMsg msg = [(clientOnly, ["ERROR", msg])]
    28 answerQuit msg = [(clientOnly, ["BYE", msg])]
    29 answerQuit msg = [(clientOnly, ["BYE", msg])]
    29 answerAbandoned = [(othersInRoom, ["BYE", "Room abandoned"])]
    30 answerAbandoned = [(othersInRoom, ["BYE", "Room abandoned"])]
    30 answerQuitInform nick = [(othersInRoom, ["LEFT", nick])]
    31 answerQuitInform nick = [(othersInRoom, ["LEFT", nick])]
    31 answerNickChosen = [(clientOnly, ["ERROR", "The nick already chosen"])]
    32 answerNickChosen = [(clientOnly, ["ERROR", "The nick already chosen"])]
    32 answerNickChooseAnother = [(clientOnly, ["WARNING", "Choose another nick"])]
    33 answerNickChooseAnother = [(clientOnly, ["WARNING", "Choose another nick"])]
    91 	(noChangeClients, noChangeRooms, answerConnected)
    92 	(noChangeClients, noChangeRooms, answerConnected)
    92 
    93 
    93 handleCmd _ _ _ ["PONG"] =
    94 handleCmd _ _ _ ["PONG"] =
    94 	(noChangeClients, noChangeRooms, [])
    95 	(noChangeClients, noChangeRooms, [])
    95 
    96 
       
    97 handleCmd _ _ _ ["ERROR", msg] =
       
    98 	(noChangeClients, noChangeRooms, answerErrorMsg msg)
       
    99 
    96 -- check state and call state-dependent commmand handlers
   100 -- check state and call state-dependent commmand handlers
    97 handleCmd client clients rooms cmd =
   101 handleCmd client clients rooms cmd =
    98 	if null (nick client) || protocol client == 0 then
   102 	if null (nick client) || protocol client == 0 then
    99 		handleCmd_noInfo client clients rooms cmd
   103 		handleCmd_noInfo client clients rooms cmd
   100 	else if null (room client) then
   104 	else if null (room client) then