--- a/gameServer/OfficialServer/DBInteraction.hs Sun Oct 28 15:18:26 2012 +0100
+++ b/gameServer/OfficialServer/DBInteraction.hs Fri Dec 06 22:20:53 2019 +0100
@@ -1,3 +1,21 @@
+{-
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ \-}
+
{-# LANGUAGE CPP, ScopedTypeVariables, OverloadedStrings #-}
module OfficialServer.DBInteraction
(
@@ -49,6 +67,8 @@
writeChan (coreChan si) $ ClientAccountInfo clId clUid (if clHost `L.elem` localAddressList then Admin else Guest)
ClearCache -> return ()
SendStats {} -> return ()
+ GetReplayName {} -> return ()
+ StoreAchievements {} -> return ()
flushRequests si
pipeDbConnectionLoop :: Chan DBQuery -> Chan CoreMessage -> Handle -> Handle -> Map.Map ByteString (UTCTime, AccountInfo) -> Int -> IO (Map.Map ByteString (UTCTime, AccountInfo), Int)
@@ -77,7 +97,22 @@
writeChan cChan $ ClientAccountInfo clId clUid (snd $ fromJust cacheEntry)
return (accountsCache, req)
+ GetReplayName {} -> do
+ SIO.hPutStrLn hIn $ show q
+ hFlush hIn
+
+ (clId', clUid', accountInfo) <- SIO.hGetLine hOut >>= (maybeException . maybeRead)
+
+ writeChan cChan $ ClientAccountInfo clId' clUid' accountInfo
+ return (accountsCache, req)
+
ClearCache -> return (Map.empty, req)
+ StoreAchievements {} -> (
+ (SIO.hPutStrLn hIn $ show q) >>
+ hFlush hIn >>
+ return (accountsCache, req))
+ `Exception.onException`
+ (unGetChan queries q)
SendStats {} -> (
(SIO.hPutStrLn hIn $ show q) >>
hFlush hIn >>