diff -r 531f64292489 -r 5a4ea2c7b9df gameServer/Utils.hs --- a/gameServer/Utils.hs Sat Oct 08 16:45:52 2011 +0200 +++ b/gameServer/Utils.hs Sat Oct 08 16:54:56 2011 +0200 @@ -26,25 +26,6 @@ $ List.intersperse (':':) $ concatMap (\n -> (\(a0, a1) -> [showHex a0, showHex a1]) $ divMod n 65536) [a, b, c, d]) [] -toEngineMsg :: B.ByteString -> B.ByteString -toEngineMsg msg = B.pack $ Base64.encode (fromIntegral (BW.length msg) : BW.unpack msg) - -fromEngineMsg :: B.ByteString -> Maybe B.ByteString -fromEngineMsg msg = liftM BW.pack (Base64.decode (B.unpack msg) >>= removeLength) - where - removeLength (x:xs) = if length xs == fromIntegral x then Just xs else Nothing - removeLength _ = Nothing - -checkNetCmd :: B.ByteString -> (Bool, Bool) -checkNetCmd msg = check decoded - where - decoded = fromEngineMsg msg - check Nothing = (False, False) - check (Just ms) | B.length ms > 0 = let m = B.head ms in (m `Set.member` legalMessages, m == '+') - | otherwise = (False, False) - legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages - slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" - maybeRead :: Read a => String -> Maybe a maybeRead s = case reads s of [(x, rest)] | all isSpace rest -> Just x @@ -103,6 +84,8 @@ , (35, "0.9.14.1") , (37, "0.9.15") , (38, "0.9.16-dev") + , (39, "0.9.16") + , (40, "0.9.17-dev") ] askFromConsole :: B.ByteString -> IO B.ByteString