summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 21:39:32 +0000
committerpb <pb@9f8f72e9-4bf4-416e-b76e-7d4203597157>2010-03-28 21:39:32 +0000
commit2341aa600daac2c8afa366cd612a893580104a93 (patch)
tree0b5586310a11af2b07abb439a9b9ad87d69f07ac
parenteb0ca70a636183fea73d884e20a48ac6120066bc (diff)
git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@55 9f8f72e9-4bf4-416e-b76e-7d4203597157
-rw-r--r--HsBot/Base/State.hs14
-rw-r--r--HsBot/Callbacks/MessageCounter.hs4
-rw-r--r--HsBot/IRC/User.hs4
3 files changed, 17 insertions, 5 deletions
diff --git a/HsBot/Base/State.hs b/HsBot/Base/State.hs
index c4c361a..2547501 100644
--- a/HsBot/Base/State.hs
+++ b/HsBot/Base/State.hs
@@ -1,3 +1,8 @@
+-- {-# LANGUAGE MultiParamTypeClasses #-}
+-- {-# LANGUAGE FunctionalDependencies #-}
+-- {-# LANGUAGE FlexibleInstances #-}
+-- {-# LANGUAGE NoMonomorphismRestriction #-}
+
module HsBot.Base.State where
import qualified Data.Map as M
@@ -13,6 +18,15 @@ data State = State {
users :: [User]
} deriving (Show, Read)
+makeDefaultState :: State
+makeDefaultState = State {
+ isReady = False,
+ currentSender = "",
+ currentChannel = "",
+ line = "",
+ users = []
+ }
+
stateNumUsers :: State -> Int
stateNumUsers state = length $ users state
diff --git a/HsBot/Callbacks/MessageCounter.hs b/HsBot/Callbacks/MessageCounter.hs
index e4f8f3d..e3d8648 100644
--- a/HsBot/Callbacks/MessageCounter.hs
+++ b/HsBot/Callbacks/MessageCounter.hs
@@ -7,6 +7,6 @@ import HsBot.IRC.User
messageCounter :: String -> SendMessage -> Env -> IO Env
messageCounter str sendMessage (Env state conf) = do
- let (user, users') = userGet (currentSender state) (users state)
- return (Env state { users = users' } conf)
+ let users' = users state
+ return (Env state { users = users' } conf)
diff --git a/HsBot/IRC/User.hs b/HsBot/IRC/User.hs
index 375e55e..b45a088 100644
--- a/HsBot/IRC/User.hs
+++ b/HsBot/IRC/User.hs
@@ -1,6 +1,7 @@
module HsBot.IRC.User where
import List
+import Monad
import HsBot.General.Render
@@ -47,6 +48,3 @@ userGet name xs =
Just user -> (user, xs)
Nothing -> let user = userMakeDefault name in (user, user : xs)
-
-
-