summaryrefslogtreecommitdiff
path: root/Hsbot/Core.hs
diff options
context:
space:
mode:
authorJulien Dessaux2009-08-05 01:01:47 +0200
committerJulien Dessaux2009-08-05 01:01:47 +0200
commit1f6c64749d39eb31f171b7fa3a44cbe396bbf071 (patch)
tree23caca402ad07b849661678662f748b9e5cc7355 /Hsbot/Core.hs
parentInitial import (diff)
downloadhsbot-1f6c64749d39eb31f171b7fa3a44cbe396bbf071.tar.gz
hsbot-1f6c64749d39eb31f171b7fa3a44cbe396bbf071.tar.bz2
hsbot-1f6c64749d39eb31f171b7fa3a44cbe396bbf071.zip
Wrote a dynamic compilation stuff that works (unable to test reboot yet)
Diffstat (limited to '')
-rw-r--r--Hsbot/Core.hs36
1 files changed, 36 insertions, 0 deletions
diff --git a/Hsbot/Core.hs b/Hsbot/Core.hs
new file mode 100644
index 0000000..153ce77
--- /dev/null
+++ b/Hsbot/Core.hs
@@ -0,0 +1,36 @@
+module Hsbot.Core
+ ( Bot(..)
+ , Config(..)
+ , Server(..)
+ , newbot
+ ) where
+
+import qualified Data.Map as M
+import System.IO (Handle)
+
+-- | An IRC Bot server state (socket handles)
+data Bot = Bot
+ { joinedServers :: M.Map Server Handle -- servers we are connected to
+ } deriving (Eq, Show)
+
+-- | Configuration data type
+data Config = Config {
+ commandPrefixes :: String, -- command prefixes, for example @[\'>\',\'@\',\'?\']@
+ servers :: [Server] -- list of 'Server's to connect to
+} deriving (Eq,Show)
+
+-- | An IRC server
+data Server = Server
+ { address :: String -- the server's address
+ , port :: Int -- the server's port
+ , channels :: [String] -- a list of channels to join
+ , nickname :: String -- the hsbot's nickname
+ , password :: String -- the hsbot's password, optional
+ , realname :: String -- the hsbot's real name, optional
+ , administrators :: [String] -- bot admins nicknames
+ } deriving (Eq, Show)
+
+-- | Returns a new, empty bot
+newbot :: Bot
+newbot = Bot (M.empty)
+