summaryrefslogtreecommitdiff
path: root/HsBot/Start.hs
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 11:09:30 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 11:09:30 +0000
commit80ff91aa5d6cda6adc1c97dc39b950dd7daed9d5 (patch)
tree4b1ad4310067e9ee9b5dcbae027844ed596e015f /HsBot/Start.hs
parent7a7302c5b86e89f3fc2fbc3476db731dfd6ed11b (diff)
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@50 9f8f72e9-4bf4-416e-b76e-7d4203597157
Diffstat (limited to 'HsBot/Start.hs')
-rw-r--r--HsBot/Start.hs51
1 files changed, 0 insertions, 51 deletions
diff --git a/HsBot/Start.hs b/HsBot/Start.hs
deleted file mode 100644
index 97466d8..0000000
--- a/HsBot/Start.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-module HsBot.Start (start) where
-
-import System
-
-import HsBot.Cmd
-import HsBot.Conf
-import HsBot.Env
-import HsBot.IRC
-import HsBot.Logics
-import HsBot.State
-import HsBot.General.Tools
-
-start :: IO ()
-start = do
- let conf = makeConf
- databaseFile <- get "databaseFile" conf
- let state = stateLoad databaseFile
- state' <- state -- Extract State from the IO Monad
- ircStart (DispatchEnv state' conf dispatch)
-
-dispatch :: Dispatch
-dispatch msg sendMessage env@(Env state conf) = dispatch' msg
- where
- dispatch' ('!':_) =
- case cmdGet msg commands of
- Just (Cmd _ _ cmdAction) -> do
- cmdAction state
- return (env)
- Nothing -> return (env)
- dispatch' _ = logicsRun msg env
- commands = [
- Cmd "!h" "Prints help" printHelp,
- Cmd "!i" "Prints infos" printInfos,
- Cmd "!p" "Prints current state" printState,
- Cmd "!s" "Stores current state to file" storeState,
- Cmd "!q" "quits" quit
- ]
- printHelp _ = printHelp' commands
- where printHelp' = sendMessage . concat . showL
- printInfos _ = do
- sendMessage $ (envGet "name" env)
- ++ " " ++ (envGet "version" env)
- ++ " (try !h)"
- printState = sendMessage . show
- storeState state = do
- sendMessage "Storing current state"
- stateSave (envGet "databaseFile" env) state
- quit state = do
- sendMessage "Good bye"
- stateSave (envGet "databaseFile" env) state
- exitWith ExitSuccess