summaryrefslogtreecommitdiffstats
path: root/Hirc/Types.hs
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-10-17 19:08:15 +0200
committertv <tv@shackspace.de>2015-10-17 19:25:29 +0200
commitef344c57945d455c6752c2032c701d7f9315f69b (patch)
tree21139cf0cd844eb661e80978c04f91de48b93907 /Hirc/Types.hs
parent3a2775bc5bd132109c8cfbd84b11a1e7cf633311 (diff)
replace hirc.hs by main.hs
Diffstat (limited to 'Hirc/Types.hs')
-rw-r--r--Hirc/Types.hs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Hirc/Types.hs b/Hirc/Types.hs
index 2567b53..c516ba7 100644
--- a/Hirc/Types.hs
+++ b/Hirc/Types.hs
@@ -1,5 +1,11 @@
+{-# LANGUAGE RecordWildCards #-}
+
module Hirc.Types where
+import System.IO (Handle)
+import Control.Concurrent.STM (TVar)
+import Control.Monad.Reader (ReaderT)
+
type Command = String
type Param = String
type Receiver = String
@@ -12,6 +18,10 @@ data Message =
}
deriving Show
+data Error =
+ BadMessage String
+ deriving Show
+
data Prefix =
Prefix {
p_name :: String,
@@ -20,3 +30,36 @@ data Prefix =
}
deriving Show
+type Net = ReaderT Bot IO
+
+data Bot = Bot {
+ bot_server :: Server,
+ bot_nick :: TVar String,
+ bot_chan :: TVar String,
+ bot_socket :: Handle
+}
+
+data Config =
+ Config {
+ config_server :: Server,
+ config_nick :: String,
+ config_chan :: String
+ }
+ deriving Show
+
+data Hooks =
+ Hooks {
+ hooks_onConnect :: Net (),
+ hooks_onDisconnect :: Net (),
+ hooks_onError :: Error -> Net (),
+ hooks_onMessage :: Message -> Net ()
+ --hooks_shell :: Net()
+ }
+
+data Server =
+ Server {
+ hostname :: String,
+ port :: Int
+ }
+instance Show Server where
+ show Server{..} = hostname ++ ":" ++ show port