irc-client-1.1.0.5: An IRC client library.

Copyright(c) 2016 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.IRC.Client.Utils

Contents

Description

Commonly-used utility functions for IRC clients.

Synopsis

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

reply :: Event Text -> Text -> IRC s () Source #

Send a message to the source of an event.

replyTo :: Source Text -> Text -> IRC s () Source #

Send a message to the source of an event.

CTCPs

ctcp :: Text -> Text -> [Text] -> Message Text Source #

Construct a PRIVMSG containing a CTCP

ctcpReply :: Text -> Text -> [Text] -> Message Text Source #

Construct a NOTICE containing a CTCP

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.

snapshotModify :: MonadIO m => Lens' s (TVar a) -> (a -> STM (a, b)) -> s -> m b Source #

Atomically snapshot and modify some shared state.

get :: Getting a s a -> s -> a Source #

Get a value from a lens.

set :: Lens' s a -> a -> s -> s Source #

Set a value in a lens.

modify :: Lens' s a -> (a -> a) -> s -> s Source #

Modify a value in a lens.