Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types for IRC clients. See also Network.IRC.Conduit and Network.IRC.CTCP.
- type UnicodeEvent = Event Text
- type UnicodeSource = Source Text
- type UnicodeMessage = Message Text
- type IRC a = ReaderT IRCState IO a
- data IRCState = IRCState {}
- newIRCState :: MonadIO m => ConnectionConfig -> InstanceConfig -> m IRCState
- ircState :: IRC IRCState
- getConnectionConfig :: IRCState -> ConnectionConfig
- getInstanceConfig :: IRCState -> TVar InstanceConfig
- getInstanceConfig' :: MonadIO m => IRCState -> m InstanceConfig
- connectionConfig :: IRC ConnectionConfig
- instanceConfigTVar :: IRC (TVar InstanceConfig)
- instanceConfig :: IRC InstanceConfig
- putInstanceConfig :: InstanceConfig -> IRC ()
- data Origin
- data ConnectionConfig = ConnectionConfig {
- _func :: Int -> ByteString -> IO () -> Consumer (Either ByteString IrcEvent) IO () -> Producer IO IrcMessage -> IO ()
- _sendqueue :: TBMChan IrcMessage
- _server :: ByteString
- _port :: Int
- _flood :: NominalDiffTime
- _disconnect :: IRC ()
- _logfunc :: Origin -> ByteString -> IO ()
- data InstanceConfig = InstanceConfig {}
- data EventType
- data EventHandler = EventHandler {
- _description :: Text
- _matchType :: EventType
- _eventFunc :: UnicodeEvent -> IRC ()
- eventType :: Event a -> EventType
- data Event a :: * -> * = Event {}
- data Source a :: * -> *
- = User (NickName a)
- | Channel (ChannelName a) (NickName a)
- | Server (ServerName a)
- data Message a :: * -> *
- = Privmsg (Target a) (Either CTCPByteString a)
- | Notice (Target a) (Either CTCPByteString a)
- | Nick (NickName a)
- | Join (ChannelName a)
- | Part (ChannelName a) (Reason a)
- | Quit (Reason a)
- | Mode (Target a) IsModeSet [ModeFlag a] [ModeArg a]
- | Topic (ChannelName a) a
- | Invite (ChannelName a) (NickName a)
- | Kick (ChannelName a) (NickName a) (Reason a)
- | Ping (ServerName a) (Maybe (ServerName a))
- | Pong (ServerName a)
- | Numeric Int [NumericArg a]
- | RawMsg a
Type synonyms
type UnicodeEvent = Event Text Source
type UnicodeSource = Source Text Source
type UnicodeMessage = Message Text Source
State
IRCState | |
|
newIRCState :: MonadIO m => ConnectionConfig -> InstanceConfig -> m IRCState Source
Construct a new IRC state
getConnectionConfig :: IRCState -> ConnectionConfig Source
Extract the connection configuration from an IRC state
getInstanceConfig :: IRCState -> TVar InstanceConfig Source
Extract the instance configuration from an IRC state
getInstanceConfig' :: MonadIO m => IRCState -> m InstanceConfig Source
Extract the current snapshot of the instance configuration from an IRC state
connectionConfig :: IRC ConnectionConfig Source
Access the connection config
instanceConfigTVar :: IRC (TVar InstanceConfig) Source
Access the instance config TVar
instanceConfig :: IRC InstanceConfig Source
Access the instance config as it is right now.
putInstanceConfig :: InstanceConfig -> IRC () Source
Overwrite the instance config, even if it has changed since we looked at it.
data ConnectionConfig Source
The static state of an IRC server connection.
ConnectionConfig | |
|
data InstanceConfig Source
The updateable state of an IRC connection.
InstanceConfig | |
|
Events
Types of events which can be caught.
data EventHandler Source
A function which handles an event.
EventHandler | |
|
Re-exported
data Source a :: * -> *
The source of an IRC message.
User (NickName a) | The message comes directly from a user. |
Channel (ChannelName a) (NickName a) | The message comes from a user in a channel. |
Server (ServerName a) | The message comes directly from the server. |
data Message a :: * -> *
A decoded IRC message.
Privmsg (Target a) (Either CTCPByteString a) | A message, either from a user or to a channel the client is in. CTCPs are distinguished by starting and ending with a \001 (SOH). |
Notice (Target a) (Either CTCPByteString a) | Like a privmsg, but should not provoke an automatic response. |
Nick (NickName a) | Someone has updated their nick. |
Join (ChannelName a) | Someone has joined a channel. |
Part (ChannelName a) (Reason a) | Someone has left a channel. |
Quit (Reason a) | Someone has left the network. |
Mode (Target a) IsModeSet [ModeFlag a] [ModeArg a] | Someone has set some channel modes or user modes. |
Topic (ChannelName a) a | Someone has set the topic of a channel. |
Invite (ChannelName a) (NickName a) | The client has been invited to a channel. |
Kick (ChannelName a) (NickName a) (Reason a) | Someone has been kicked from a channel. |
Ping (ServerName a) (Maybe (ServerName a)) | The client has received a server ping, and should send a pong asap. |
Pong (ServerName a) | A pong sent to the named server. |
Numeric Int [NumericArg a] | One of the many server numeric responses. |
RawMsg a | Never produced by decoding, but can be used to send arbitrary bytestrings to the IRC server. Naturally, this should only be used when you are confident that the produced bytestring will be a valid IRC message. |