renamed "Server" algebraic data type to "IrcServer"
This commit is contained in:
parent
1f6c64749d
commit
45ebb68aa0
3 changed files with 9 additions and 9 deletions
|
@ -7,7 +7,7 @@ import Hsbot.Core
|
||||||
-- | Imported plugins goes there
|
-- | Imported plugins goes there
|
||||||
|
|
||||||
-- | User server
|
-- | User server
|
||||||
kro = Server
|
kro = IrcServer
|
||||||
{ address = "kro.corp"
|
{ address = "kro.corp"
|
||||||
, port = 6667
|
, port = 6667
|
||||||
, channels = ["#geek"]
|
, channels = ["#geek"]
|
||||||
|
@ -21,6 +21,6 @@ kro = Server
|
||||||
config :: Config
|
config :: Config
|
||||||
config = Config
|
config = Config
|
||||||
{ commandPrefixes = ['@']
|
{ commandPrefixes = ['@']
|
||||||
, servers = [kro]
|
, ircServers = [kro]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Hsbot.Core
|
module Hsbot.Core
|
||||||
( Bot(..)
|
( Bot(..)
|
||||||
, Config(..)
|
, Config(..)
|
||||||
, Server(..)
|
, IrcServer(..)
|
||||||
, newbot
|
, newbot
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -10,17 +10,17 @@ import System.IO (Handle)
|
||||||
|
|
||||||
-- | An IRC Bot server state (socket handles)
|
-- | An IRC Bot server state (socket handles)
|
||||||
data Bot = Bot
|
data Bot = Bot
|
||||||
{ joinedServers :: M.Map Server Handle -- servers we are connected to
|
{ joinedServers :: M.Map IrcServer Handle -- servers we are connected to
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
-- | Configuration data type
|
-- | Configuration data type
|
||||||
data Config = Config {
|
data Config = Config {
|
||||||
commandPrefixes :: String, -- command prefixes, for example @[\'>\',\'@\',\'?\']@
|
commandPrefixes :: String, -- command prefixes, for example @[\'>\',\'@\',\'?\']@
|
||||||
servers :: [Server] -- list of 'Server's to connect to
|
ircServers :: [IrcServer] -- list of 'Server's to connect to
|
||||||
} deriving (Eq,Show)
|
} deriving (Eq,Show)
|
||||||
|
|
||||||
-- | An IRC server
|
-- | An IRC server
|
||||||
data Server = Server
|
data IrcServer = IrcServer
|
||||||
{ address :: String -- the server's address
|
{ address :: String -- the server's address
|
||||||
, port :: Int -- the server's port
|
, port :: Int -- the server's port
|
||||||
, channels :: [String] -- a list of channels to join
|
, channels :: [String] -- a list of channels to join
|
||||||
|
|
|
@ -22,9 +22,9 @@ data IrcInput = Cmd User Channel (Command, Maybe String) -- a regular command
|
||||||
|
|
||||||
-- | Data that can go over the remote channel
|
-- | Data that can go over the remote channel
|
||||||
data IrcOutput = Str String -- a regular string
|
data IrcOutput = Str String -- a regular string
|
||||||
| Quit (Server, Handle) -- a quit message from a server
|
| Quit (IrcServer, Handle) -- a quit message from a server
|
||||||
| Join (Server, Channel) -- joined a channel
|
| Join (IrcServer, Channel) -- joined a channel
|
||||||
| Part (Server, Channel) -- parted the channel
|
| Part (IrcServer, Channel) -- parted the channel
|
||||||
| Reboot -- reboot message sent
|
| Reboot -- reboot message sent
|
||||||
| Nil -- signifies thread death, only happens after reboot
|
| Nil -- signifies thread death, only happens after reboot
|
||||||
deriving (Eq,Show)
|
deriving (Eq,Show)
|
||||||
|
|
Reference in a new issue