--- a/netserver/HWProto.hs Wed Apr 30 20:14:09 2008 +0000
+++ b/netserver/HWProto.hs Wed Apr 30 20:18:30 2008 +0000
@@ -3,12 +3,12 @@
import IO
import Miscutils
-handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> (Bool, [ClientInfo], [String])
+handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> ([ClientInfo], [String])
handleCmd client clients _ ("QUIT":xs) =
if null (room client) then
- (True, [client], ["QUIT"])
+ ([client], ["QUIT"])
else
- (True, clients, ["QUIT " ++ nick client])
+ (clients, ["QUIT", nick client])
-handleCmd client _ _ _ = (False, [client], ["Bad command"])
+handleCmd client _ _ _ = ([client], ["Bad command"])
--- a/netserver/newhwserv.hs Wed Apr 30 20:14:09 2008 +0000
+++ b/netserver/newhwserv.hs Wed Apr 30 20:18:30 2008 +0000
@@ -39,7 +39,7 @@
Left ci -> do
mainLoop servSock acceptChan (ci:clients) rooms
Right (line, client) -> do
- let (doQuit, recipients, strs) = handleCmd client sameRoom rooms $ words line
+ let (recipients, strs) = handleCmd client sameRoom rooms $ words line
clients' <- forM recipients $
\ci -> do
@@ -48,7 +48,7 @@
return []
`catch` const (hClose (handle ci) >> return [ci])
- client' <- if doQuit then hClose (handle client) >> return [client] else return []
+ client' <- if head strs == "QUIT" then hClose (handle client) >> return [client] else return []
mainLoop servSock acceptChan (remove (remove clients (concat clients')) client') rooms
where