# HG changeset patch # User unc0rr # Date 1224366448 0 # Node ID e9754d1d61a99571dd78fe243e7510213e72e14c # Parent f3bdfe2452f2e7c0a0ccd8cc3fafcb7b14ead11e Log reply only when send it diff -r f3bdfe2452f2 -r e9754d1d61a9 netserver/HWProto.hs --- a/netserver/HWProto.hs Sat Oct 18 17:03:38 2008 +0000 +++ b/netserver/HWProto.hs Sat Oct 18 21:47:28 2008 +0000 @@ -15,7 +15,7 @@ answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])] answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])] answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])] -answerQuit = [(clientOnly, ["off"])] +answerQuit = [(clientOnly, ["BYE"])] answerAbandoned = [(othersInRoom, ["BYE"])] answerQuitInform nick = [(othersInRoom, ["LEFT", nick])] answerNickChosen = [(clientOnly, ["ERROR", "The nick already chosen"])] diff -r f3bdfe2452f2 -r e9754d1d61a9 netserver/hedgewars-server.hs --- a/netserver/hedgewars-server.hs Sat Oct 18 17:03:38 2008 +0000 +++ b/netserver/hedgewars-server.hs Sat Oct 18 21:47:28 2008 +0000 @@ -6,7 +6,7 @@ import Control.Concurrent import Control.Concurrent.STM import Control.Exception (setUncaughtExceptionHandler, handle, finally) -import Control.Monad (forM, forM_, filterM, liftM) +import Control.Monad (forM, forM_, filterM, liftM, unless) import Maybe (fromMaybe) import Data.List import Miscutils @@ -44,11 +44,10 @@ sendAnswers [] _ clients _ = return clients sendAnswers ((handlesFunc, answer):answers) client clients rooms = do let recipients = handlesFunc client clients rooms - putStrLn ("< " ++ (show answer)) + unless (null recipients) $ putStrLn ("< " ++ (show answer)) clHandles' <- forM recipients $ \ch -> Control.Exception.handle (\e -> putStrLn (show e) >> hClose ch >> return [ch]) $ - if (not $ null answer) && (head answer == "off") then hClose ch >> return [ch] else -- probably client with exception, don't send him anything do forM_ answer (\str -> hPutStrLn ch str) hPutStrLn ch ""