summaryrefslogtreecommitdiff
path: root/HsBot/Base/State.hs
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-05-15 16:49:57 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-05-15 16:49:57 +0000
commit502eae3f286cca6a1843ed795ec20fbc3abccc5d (patch)
tree77825cba7281516d2bcf7f38e0cb0aa70652dec9 /HsBot/Base/State.hs
parentad2e856414300fafee5ab4afd4f2356b0c2fd159 (diff)
added the stateUpdateUser function to State.hs
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@60 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'HsBot/Base/State.hs')
-rw-r--r--HsBot/Base/State.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/HsBot/Base/State.hs b/HsBot/Base/State.hs
index 10395bb..9c38e42 100644
--- a/HsBot/Base/State.hs
+++ b/HsBot/Base/State.hs
@@ -33,6 +33,11 @@ stateNumUsers state = length $ users state
stateSortedUsers :: State -> [User]
stateSortedUsers state = sort $ users state
+stateUpdateUser :: State -> String -> (User -> User) -> State
+stateUpdateUser state name update =
+ let updatedUsers = usersUpdate name (users state) update
+ in state { users = updatedUsers }
+
stateLoad :: String -> IO State
stateLoad databaseFile = do
file <- readFile databaseFile