Copyright | (c) 2016 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <[email protected]> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Network.IRC.Client.Utils
Description
Commonly-used utility functions for IRC clients.
Synopsis
- setNick :: Text -> IRC s ()
- leaveChannel :: Text -> Maybe Text -> IRC s ()
- delChan :: TVar (InstanceConfig s) -> Text -> STM ()
- addHandler :: EventHandler s -> IRC s ()
- reply :: Event Text -> Text -> IRC s ()
- replyTo :: Source Text -> Text -> IRC s ()
- ctcp :: Text -> Text -> [Text] -> Message Text
- ctcpReply :: Text -> Text -> [Text] -> Message Text
- isConnected :: IRC s Bool
- isDisconnecting :: IRC s Bool
- isDisconnected :: IRC s Bool
- snapConnState :: IRC s ConnectionState
- fork :: IRC s () -> IRC s ThreadId
- snapshot :: MonadIO m => Getting (TVar a) s (TVar a) -> s -> m a
- snapshotModify :: MonadIO m => Lens' s (TVar a) -> (a -> STM (a, b)) -> s -> m b
- get :: Getting a s a -> s -> a
- set :: Lens' s a -> a -> s -> s
- modify :: Lens' s a -> (a -> a) -> s -> s
Nicks
setNick :: Text -> IRC s () Source #
Update the nick in the instance configuration and also send an update message to the server. This doesn't attempt to resolve nick collisions, that's up to the event handlers.
Channels
leaveChannel :: Text -> Maybe Text -> IRC s () Source #
Update the channel list in the instance configuration and also part the channel.
delChan :: TVar (InstanceConfig s) -> Text -> STM () Source #
Remove a channel from the list without sending a part command (be careful not to let the channel list get out of sync with the real-world state if you use it for anything!)
Events
addHandler :: EventHandler s -> IRC s () Source #
Add an event handler
CTCPs
Connection state
isConnected :: IRC s Bool Source #
Check if the client is connected.
isDisconnecting :: IRC s Bool Source #
Check if the client is in the process of disconnecting.
isDisconnected :: IRC s Bool Source #
Check if the client is disconnected
snapConnState :: IRC s ConnectionState Source #
Snapshot the connection state.
Concurrency
fork :: IRC s () -> IRC s ThreadId Source #
Fork a thread which will be thrown a Disconnect
exception when
the client disconnects.
Lenses
snapshot :: MonadIO m => Getting (TVar a) s (TVar a) -> s -> m a Source #
Atomically snapshot some shared state.