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 = StatefulIRC () a
- type StatefulIRC s a = ReaderT (IRCState s) IO a
- data IRCState s = IRCState {
- _connectionConfig :: ConnectionConfig s
- _userState :: TVar s
- _instanceConfig :: TVar (InstanceConfig s)
- newIRCState :: MonadIO m => ConnectionConfig s -> InstanceConfig s -> s -> m (IRCState s)
- ircState :: StatefulIRC s (IRCState s)
- getConnectionConfig :: IRCState s -> ConnectionConfig s
- getInstanceConfig :: IRCState s -> TVar (InstanceConfig s)
- getUserState :: IRCState s -> TVar s
- getInstanceConfig' :: MonadIO m => IRCState s -> m (InstanceConfig s)
- connectionConfig :: StatefulIRC s (ConnectionConfig s)
- instanceConfigTVar :: StatefulIRC s (TVar (InstanceConfig s))
- instanceConfig :: StatefulIRC s (InstanceConfig s)
- putInstanceConfig :: InstanceConfig s -> StatefulIRC s ()
- stateTVar :: StatefulIRC s (TVar s)
- state :: StatefulIRC s s
- putState :: s -> StatefulIRC s ()
- data Origin
- data ConnectionConfig s = ConnectionConfig {
- _func :: Int -> ByteString -> IO () -> Consumer (Either ByteString IrcEvent) IO () -> Producer IO IrcMessage -> IO ()
- _sendqueue :: TBMChan IrcMessage
- _server :: ByteString
- _port :: Int
- _flood :: NominalDiffTime
- _onconnect :: StatefulIRC s ()
- _ondisconnect :: StatefulIRC s ()
- _logfunc :: Origin -> ByteString -> IO ()
- data InstanceConfig s = InstanceConfig {}
- data EventType
- data EventHandler s = EventHandler {
- _description :: Text
- _matchType :: EventType
- _eventFunc :: UnicodeEvent -> StatefulIRC s ()
- 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
type IRC a = StatefulIRC () a Source #
The IRC monad.
IRCState | |
|
newIRCState :: MonadIO m => ConnectionConfig s -> InstanceConfig s -> s -> m (IRCState s) Source #
Construct a new IRC state
ircState :: StatefulIRC s (IRCState s) Source #
Access the client state.
getConnectionConfig :: IRCState s -> ConnectionConfig s Source #
Extract the connection configuration from an IRC state
getInstanceConfig :: IRCState s -> TVar (InstanceConfig s) Source #
Extract the instance configuration from an IRC state
getUserState :: IRCState s -> TVar s Source #
Extract the user state from an IRC state
getInstanceConfig' :: MonadIO m => IRCState s -> m (InstanceConfig s) Source #
Extract the current snapshot of the instance configuration from an IRC state
connectionConfig :: StatefulIRC s (ConnectionConfig s) Source #
Access the connection config
instanceConfigTVar :: StatefulIRC s (TVar (InstanceConfig s)) Source #
Access the instance config TVar
instanceConfig :: StatefulIRC s (InstanceConfig s) Source #
Access the instance config as it is right now.
putInstanceConfig :: InstanceConfig s -> StatefulIRC s () Source #
Overwrite the instance config, even if it has changed since we looked at it.
stateTVar :: StatefulIRC s (TVar s) Source #
Access the user state.
state :: StatefulIRC s s Source #
Access the user state as it is right now.
putState :: s -> StatefulIRC s () Source #
Set the user state.
The origin of a message.
data ConnectionConfig s Source #
The static state of an IRC server connection.
ConnectionConfig | |
|
data InstanceConfig s Source #
The updateable state of an IRC connection.
InstanceConfig | |
|
Events
Types of events which can be caught.
data EventHandler s Source #
A function which handles an event.
EventHandler | |
|
Re-exported
A decoded IRC message + source.
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. |
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. |