Store bans in .ini file
authorunc0rr
Sun, 13 Mar 2011 20:34:01 +0300
changeset 5009 12135f659bf1
parent 5008 af9e4a66111b
child 5010 af4e205e4b5a
Store bans in .ini file
gameServer/ConfigFile.hs
--- a/gameServer/ConfigFile.hs	Sun Mar 13 20:25:44 2011 +0300
+++ b/gameServer/ConfigFile.hs	Sun Mar 13 20:34:01 2011 +0300
@@ -21,6 +21,7 @@
         , dbPassword = value "dbPassword" cfg
         , serverMessage = value "sv_message" cfg
         , serverMessageForOldVersions = value "sv_messageOld" cfg
+        , bans = read . fromJust2 "bans" $ getValue "bans" cfg
         , latestReleaseVersion = read . fromJust $ getValue "sv_latestProto" cfg
         , serverConfig = Just cfg
     }
@@ -40,13 +41,16 @@
     dbPassword = dp,
     serverMessage = sm,
     serverMessageForOldVersions = smo,
+    bans = b,
     latestReleaseVersion = ver,
     serverConfig = Just cfg}
-        = do
-    let newCfg = foldl (\c (n, v) -> repConfig n (B.unpack v) c) cfg entries
-    writeConfig cfgFileName (repConfig "sv_latestProto" (show ver) newCfg)
+        =
+    writeConfig cfgFileName $ foldl1 (.) entries cfg
     where
-        entries = [
+        entries =
+            repConfig "sv_latestProto" (show ver)
+            : repConfig "bans" (show b)
+            : map (\(n, v) -> repConfig n (B.unpack v)) [
             ("dbHost", dh)
             , ("dbName", dn)
             , ("dbLogin", dl)
@@ -54,3 +58,4 @@
             , ("sv_message", sm)
             , ("sv_messageOld", smo)
             ]
+        
\ No newline at end of file