netserver/HWProto.hs
changeset 897 35d91fa3753b
parent 896 93df8ac94382
child 898 344ba7dba23d
equal deleted inserted replaced
896:93df8ac94382 897:35d91fa3753b
    64 handleCmd_noRoom client clients rooms ("JOIN":roomName:[]) =
    64 handleCmd_noRoom client clients rooms ("JOIN":roomName:[]) =
    65 	handleCmd_noRoom client clients rooms ["JOIN", roomName, ""]
    65 	handleCmd_noRoom client clients rooms ["JOIN", roomName, ""]
    66 
    66 
    67 handleCmd_noRoom client _ rooms _ = (client, rooms, [client], ["ERROR", "Bad command or incorrect parameter"])
    67 handleCmd_noRoom client _ rooms _ = (client, rooms, [client], ["ERROR", "Bad command or incorrect parameter"])
    68 
    68 
       
    69 -- 'inRoom' clients state command handlers
       
    70 handleCmd_inRoom :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> (ClientInfo, [RoomInfo], [ClientInfo], [String])
       
    71 
       
    72 handleCmd_inRoom client _ rooms _ = (client, rooms, [client], ["ERROR", "Bad command or incorrect parameter"])
       
    73 
    69 -- state-independent comman handlers	
    74 -- state-independent comman handlers	
    70 handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> (ClientInfo, [RoomInfo], [ClientInfo], [String])
    75 handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> (ClientInfo, [RoomInfo], [ClientInfo], [String])
    71 
    76 
    72 handleCmd client clients rooms ("QUIT":xs) =
    77 handleCmd client clients rooms ("QUIT":xs) =
    73 	if null (room client) then
    78 	if null (room client) then
    77 
    82 
    78 -- check state and call state-dependent commmand handlers
    83 -- check state and call state-dependent commmand handlers
    79 handleCmd client clients rooms cmd =
    84 handleCmd client clients rooms cmd =
    80 	if null (nick client) || protocol client == 0 then
    85 	if null (nick client) || protocol client == 0 then
    81 		handleCmd_noInfo client clients rooms cmd
    86 		handleCmd_noInfo client clients rooms cmd
       
    87 	else if null (room client) then
       
    88 		handleCmd_noRoom client clients rooms cmd
    82 	else
    89 	else
    83 		handleCmd_noRoom client clients rooms cmd
    90 		handleCmd_inRoom client clients rooms cmd