-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Console IRC client @package glirc @version 2.0 -- | This module implements a simple rate limiter based on the IRC RFC to -- be used to keep an IRC client from getting disconnected for flooding. -- It allows one event per duration with a given threshold. -- -- This algorithm keeps track of the time at which the client may start -- sending messages. Each message sent advances that time into the future -- by the penalty. The client is allowed to transmit up to -- threshold seconds ahead of this time. module Irc.RateLimit -- | The RateLimit keeps track of rate limit settings as well as the -- current state of the limit. data RateLimit -- | Construct a new rate limit with the given penalty and threshold. newRateLimit :: Int -> Int -> IO RateLimit -- | Construct a new rate limit with the RFC 2813 specified 2 second -- penalty and 10 second threshold newRateLimitDefault :: IO RateLimit -- | Account for an event in the context of a RateLimit. This -- command will block and delay as required to satisfy the current rate. -- Once it returns it is safe to proceed with the rate limited action. tickRateLimit :: RateLimit -> IO () -- | This module parses mIRC encoded text and generates VTY images. module Client.MircFormatting -- | Parse mIRC encoded format characters and hide the control characters. parseIrcText :: Text -> Image -- | Parse mIRC encoded format characters and render the control characters -- explicitly. This view is useful when inputting control characters to -- make it clear where they are in the text. parseIrcTextExplicit :: Text -> Image -- | This module defines support for working with IRC's numeric reply -- codes. Pattern synonyms are provided for each of the possible IRC -- reply codes. -- -- Reply code information was extracted from -- https://www.alien.net.au/irc/irc2numerics.html module Irc.Codes -- | Categories for reply codes data ReplyType -- | 0-99 Messages between client and server ClientServerReply :: ReplyType -- | 200-399 Responses to commands CommandReply :: ReplyType -- | 200-399 Errors ErrorReply :: ReplyType -- | Uncategorized CustomReply :: ReplyType -- | Categorize replies according to the ranges provided in RFC 2812 replyType :: Int -> ReplyType -- | This module provides tools for producing structured configuration -- information out of configuration values. module Config.FromConfig -- | Configuration parser tracking current location and for propagating -- error information. data ConfigParser a -- | Parse a Value according to the method in the FromConfig decodeConfig :: FromConfig a => Value -> Either Text a -- | Run a top-level parser to either get the parsed value or an error -- message. runConfigParser :: ConfigParser a -> Either Text a -- | A parser that always fails with the given error message. failure :: Text -> ConfigParser a -- | Class for types that have a well-known way to parse them. class FromConfig a -- | Parse a value parseConfig :: FromConfig a => Value -> ConfigParser a -- | Parser for consuming key-value pairs of sections. data SectionParser a -- | Run a SectionParser given particular Value. This will -- only succeed when the value is a Sections and the section -- parser consumes all of the sections from that value. parseSections :: SectionParser a -> Value -> ConfigParser a -- | Parse the value at the given section or fail. sectionReq :: FromConfig a => Text -> SectionParser a -- |
--   sectionOpt = sectionOptWith parseConfig
--   
sectionOpt :: FromConfig a => Text -> SectionParser (Maybe a) -- | Parses the value stored at the given section with the given parser. -- Nothing is returned if the section is missing. Just is returned if the -- parse succeeds Error is raised if the section is present but the parse -- fails sectionOptWith :: (Value -> ConfigParser a) -> Text -> SectionParser (Maybe a) -- | Lift a ConfigParser into a SectionParser leaving the -- current section information unmodified. liftConfigParser :: ConfigParser a -> SectionParser a instance GHC.Base.Monad Config.FromConfig.SectionParser instance GHC.Base.Applicative Config.FromConfig.SectionParser instance GHC.Base.Functor Config.FromConfig.SectionParser instance GHC.Base.Monad Config.FromConfig.ConfigParser instance GHC.Base.Applicative Config.FromConfig.ConfigParser instance GHC.Base.Functor Config.FromConfig.ConfigParser instance Config.FromConfig.FromConfig Data.Text.Internal.Text instance Config.FromConfig.FromConfig GHC.Integer.Type.Integer instance Config.FromConfig.FromConfig Config.Value.Atom instance Config.FromConfig.FromConfig a => Config.FromConfig.FromConfig [a] -- | This module provides support for the text operations important for -- providing a text input in the IRC client. It tracks user input -- history, tab completion history, and provides many update operations -- which are mapped to the keyboard in Client.EventLoop. module Client.EditBox data EditBox content :: Lens' EditBox String pos :: Lens' EditBox Int tabSeed :: Lens' EditBox (Maybe String) -- | Delete the character after the cursor. delete :: EditBox -> EditBox -- | Delete the character before the cursor. backspace :: EditBox -> EditBox -- | Jump the cursor to the beginning of the input. home :: EditBox -> EditBox -- | Jump the cursor to the end of the input. end :: EditBox -> EditBox -- | Delete all text from the cursor to the beginning and store it in the -- yank buffer. killHome :: EditBox -> EditBox -- | Delete all text from the cursor to the end and store it in the yank -- buffer. killEnd :: EditBox -> EditBox -- | Kill the content from the cursor back to the previous word boundary. -- When yank is set the yank buffer will be updated. killWord :: Bool -> EditBox -> EditBox -- | Insert the yank buffer at the cursor. paste :: EditBox -> EditBox -- | Move the cursor left. left :: EditBox -> EditBox -- | Move the cursor right. right :: EditBox -> EditBox -- | Move the cursor left to the previous word boundary. leftWord :: EditBox -> EditBox -- | Move the cursor right to the next word boundary. rightWord :: EditBox -> EditBox -- | Insert a character at the cursor and advance the cursor. insert :: Char -> EditBox -> EditBox -- | Insert a string at the cursor and advance the cursor. insertString :: String -> EditBox -> EditBox -- | Default 'EditBox value empty :: EditBox -- | Update the editbox to reflect the earlier element in the history. earlier :: EditBox -> Maybe EditBox -- | Update the editbox to reflect the later element in the history. later :: EditBox -> Maybe EditBox -- | Indicate that the contents of the text box were successfully used by -- the program. This clears the contents and cursor and updates the -- history. success :: EditBox -> EditBox instance GHC.Show.Show Client.EditBox.EditBox instance GHC.Read.Read Client.EditBox.EditBox -- | This module provides functions that are useful with lenses. module LensUtils data Id' a -- | Modify the target of a Setter with a function. The result is -- strict in the results of applying the function. Strict version of -- over overStrict :: LensLike Id' s t a b -> (a -> b) -> s -> t -- | Set a value strictly in the set value. Strict version of set. setStrict :: ASetter s t a b -> b -> s -> t instance GHC.Base.Functor LensUtils.Id' instance GHC.Base.Applicative LensUtils.Id' -- | This module provides support for interpreting the modes changed by a -- MODE command. module Irc.Modes -- | Settings that describe how to interpret channel modes data ModeTypes ModeTypes :: ![Char] -> ![Char] -> ![Char] -> ![Char] -> ![(Char, Char)] -> ModeTypes -- | modes for channel lists (e.g. ban) [_modesLists] :: ModeTypes -> ![Char] -- | modes that always have an argument [_modesAlwaysArg] :: ModeTypes -> ![Char] -- | modes that have an argument when set [_modesSetArg] :: ModeTypes -> ![Char] -- | modes that never have arguments [_modesNeverArg] :: ModeTypes -> ![Char] -- | modes requiring a nickname argument (mode,sigil) [_modesPrefixModes] :: ModeTypes -> ![(Char, Char)] modesLists :: Lens' ModeTypes [Char] modesAlwaysArg :: Lens' ModeTypes [Char] modesSetArg :: Lens' ModeTypes [Char] modesNeverArg :: Lens' ModeTypes [Char] modesPrefixModes :: Lens' ModeTypes [(Char, Char)] -- | The channel modes used by Freenode defaultModeTypes :: ModeTypes -- | The default UMODE used by Freenode defaultUmodeTypes :: ModeTypes -- | Split up a mode change command and arguments into individual changes -- given a configuration. splitModes :: ModeTypes -> Text -> [Text] -> Maybe [(Bool, Char, Text)] -- | Construct the arguments to a MODE command corresponding to the given -- mode changes. unsplitModes :: [(Bool, Char, Text)] -> [Text] instance GHC.Show.Show Irc.Modes.ModeTypes module Paths_glirc version :: Version getBinDir :: IO FilePath getLibDir :: IO FilePath getDataDir :: IO FilePath getLibexecDir :: IO FilePath getDataFileName :: FilePath -> IO FilePath getSysconfDir :: IO FilePath -- | This module defines support for working with IRC's numeric reply -- codes. Pattern synonyms are provided for each of the possible IRC -- reply codes. -- -- Reply code information was extracted from -- https://www.alien.net.au/irc/irc2numerics.html module Irc.Identifier -- | Identifier representing channels and nicknames data Identifier -- | Returns the case-normalized ByteString of an Identifier -- which is suitable for comparison or hashing. idDenote :: Identifier -> ByteString -- | Construct an Identifier from a ByteString mkId :: Text -> Identifier -- | Returns the original Text of an Identifier idText :: Identifier -> Text instance GHC.Show.Show Irc.Identifier.Identifier instance GHC.Read.Read Irc.Identifier.Identifier instance GHC.Classes.Eq Irc.Identifier.Identifier instance GHC.Classes.Ord Irc.Identifier.Identifier instance Data.Hashable.Class.Hashable Irc.Identifier.Identifier -- | Information identifying users on IRC. This information includes a -- nickname and optionally a username and hostname. module Irc.UserInfo -- | UserInfo packages a nickname along with the username and -- hsotname if they are known in the current context. data UserInfo UserInfo :: !Identifier -> !(Maybe Text) -> !(Maybe Text) -> UserInfo -- | nickname [userNick] :: UserInfo -> !Identifier -- | username [userName] :: UserInfo -> !(Maybe Text) -- | hostname [userHost] :: UserInfo -> !(Maybe Text) -- | Render UserInfo as nick!username@hostname renderUserInfo :: UserInfo -> Text -- | Split up a hostmask into a nickname, username, and hostname. The -- username and hostname might not be defined but are delimited by a -- ! and @ respectively. parseUserInfo :: Text -> UserInfo -- | Lens into userNick field. uiNick :: Lens' UserInfo Identifier instance GHC.Show.Show Irc.UserInfo.UserInfo instance GHC.Read.Read Irc.UserInfo.UserInfo -- | This module provides a parser and printer for the low-level IRC -- message format. It handles splitting up IRC commands into the prefix, -- command, and arguments. module Irc.RawIrcMsg -- | RawIrcMsg breaks down the IRC protocol into its most basic -- parts. The "trailing" parameter indicated in the IRC protocol with a -- leading colon will appear as the last parameter in the parameter list. -- -- Note that RFC 2812 specifies a maximum of 15 parameters. -- --
--   :prefix COMMAND param0 param1 param2 .. paramN
--   
data RawIrcMsg RawIrcMsg :: Maybe UTCTime -> Maybe UserInfo -> Text -> [Text] -> RawIrcMsg -- | Time from znc.in/server-time-iso extension [_msgServerTime] :: RawIrcMsg -> Maybe UTCTime -- | Optional sender of message [_msgPrefix] :: RawIrcMsg -> Maybe UserInfo -- | command [_msgCommand] :: RawIrcMsg -> Text -- | command parameters [_msgParams] :: RawIrcMsg -> [Text] -- | Construct a new RawIrcMsg without a time or prefix. rawIrcMsg :: Text -> [Text] -> RawIrcMsg msgServerTime :: Lens' RawIrcMsg (Maybe UTCTime) msgPrefix :: Lens' RawIrcMsg (Maybe UserInfo) msgCommand :: Lens' RawIrcMsg Text msgParams :: Lens' RawIrcMsg [Text] -- | Attempt to split an IRC protocol message without its trailing newline -- information into a structured message. parseRawIrcMsg :: Text -> Maybe RawIrcMsg -- | Take the bytes up to the next space delimiter. If the first character -- of this token is a : then take the whole remaining bytestring -- -- Serialize a structured IRC protocol message back into its wire format. -- This command adds the required trailing newline. renderRawIrcMsg :: RawIrcMsg -> ByteString -- | Try to decode a message as UTF-8. If that fails interpret it as -- Windows CP1252 This helps deal with clients like XChat that get clever -- and otherwise misconfigured clients. asUtf8 :: ByteString -> Text instance GHC.Show.Show Irc.RawIrcMsg.RawIrcMsg instance GHC.Read.Read Irc.RawIrcMsg.RawIrcMsg -- | This module defines the settings used for an individual IRC -- connection. These are static settings that are not expected change -- over the lifetime of a connection. module Client.ServerSettings data ServerSettings ServerSettings :: !Text -> !Text -> !Text -> !Text -> !(Maybe Text) -> !(Maybe Text) -> !(Maybe Text) -> !HostName -> !(Maybe PortNumber) -> !Bool -> !Bool -> !(Maybe FilePath) -> !(Maybe FilePath) -> ![Text] -> !(Maybe HostName) -> !PortNumber -> ![FilePath] -> ![Identifier] -> ServerSettings -- | connection nickname [_ssNick] :: ServerSettings -> !Text -- | connection username [_ssUser] :: ServerSettings -> !Text -- | connection realname / GECOS [_ssReal] :: ServerSettings -> !Text -- | CTCP userinfo [_ssUserInfo] :: ServerSettings -> !Text -- | server password [_ssPassword] :: ServerSettings -> !(Maybe Text) -- | SASL username [_ssSaslUsername] :: ServerSettings -> !(Maybe Text) -- | SASL password [_ssSaslPassword] :: ServerSettings -> !(Maybe Text) -- | server hostname [_ssHostName] :: ServerSettings -> !HostName -- | server port [_ssPort] :: ServerSettings -> !(Maybe PortNumber) -- | use TLS to connect [_ssTls] :: ServerSettings -> !Bool -- | disable certificate checking [_ssTlsInsecure] :: ServerSettings -> !Bool -- | path to client TLS certificate [_ssTlsClientCert] :: ServerSettings -> !(Maybe FilePath) -- | path to client TLS key [_ssTlsClientKey] :: ServerSettings -> !(Maybe FilePath) -- | raw IRC messages to transmit upon successful connection [_ssConnectCmds] :: ServerSettings -> ![Text] -- | hostname of SOCKS proxy [_ssSocksHost] :: ServerSettings -> !(Maybe HostName) -- | port of SOCKS proxy [_ssSocksPort] :: ServerSettings -> !PortNumber -- | additional CA certificates for validating server [_ssServerCerts] :: ServerSettings -> ![FilePath] -- | Channels with chanserv permissions [_ssChanservChannels] :: ServerSettings -> ![Identifier] ssNick :: Lens' ServerSettings Text ssUser :: Lens' ServerSettings Text ssReal :: Lens' ServerSettings Text ssUserInfo :: Lens' ServerSettings Text ssPassword :: Lens' ServerSettings (Maybe Text) ssSaslUsername :: Lens' ServerSettings (Maybe Text) ssSaslPassword :: Lens' ServerSettings (Maybe Text) ssHostName :: Lens' ServerSettings HostName ssPort :: Lens' ServerSettings (Maybe PortNumber) ssTls :: Lens' ServerSettings Bool ssTlsInsecure :: Lens' ServerSettings Bool ssTlsClientCert :: Lens' ServerSettings (Maybe FilePath) ssTlsClientKey :: Lens' ServerSettings (Maybe FilePath) ssConnectCmds :: Lens' ServerSettings [Text] ssSocksHost :: Lens' ServerSettings (Maybe HostName) ssSocksPort :: Lens' ServerSettings PortNumber ssServerCerts :: Lens' ServerSettings [FilePath] ssChanservChannels :: Lens' ServerSettings [Identifier] -- | Load the defaults for server settings based on the environment -- variables. -- -- USER, IRCPASSSWORD, and SASLPASSWORD are -- used. loadDefaultServerSettings :: IO ServerSettings instance GHC.Show.Show Client.ServerSettings.ServerSettings -- | This module is responsible for creating Connection values for a -- particular server as specified by a ServerSettings. This -- involves setting up certificate stores an mapping network settings -- from the client configuration into the network connection library. module Client.Connect -- | Create a new Connection which will be closed when the -- continuation finishes. withConnection :: ConnectionContext -> ServerSettings -> (Connection -> IO a) -> IO a -- | This module creates network connections and thread to manage those -- connections. Events on these connections will be written to a given -- event queue, and outgoing messages are recieved on an incoming event -- queue. -- -- These network connections are rate limited for outgoing messages per -- the rate limiting algorithm given in the IRC RFC. -- -- Incoming network event messages are assumed to be framed by newlines. -- -- When a network connection terminates normally its final messages will -- be NetworkClose. When it terminates abnormally its final -- message will be NetworkError. module Client.NetworkConnection -- | Handle for a network connection data NetworkConnection -- | Identifier used to match connection events to connections. type NetworkId = Int -- | The sum of incoming events from a network connection. All events are -- annotated with a network ID matching that given when the connection -- was created as well as the time at which the message was recieved. data NetworkEvent -- | Event for a new recieved line (newline removed) NetworkLine :: !NetworkId -> !ZonedTime -> !ByteString -> NetworkEvent -- | Final message indicating the network connection failed NetworkError :: !NetworkId -> !ZonedTime -> !SomeException -> NetworkEvent -- | Final message indicating the network connection finished NetworkClose :: !NetworkId -> !ZonedTime -> NetworkEvent -- | Initiate a new network connection according to the given -- ServerSettings. All events on this connection will be added to -- the given queue. The resulting NetworkConnection value can be -- used for sending outgoing messages and for early termination of the -- connection. createConnection :: NetworkId -> ConnectionContext -> ServerSettings -> TQueue NetworkEvent -> IO NetworkConnection -- | Force the given connection to terminate. abortConnection :: NetworkConnection -> IO () -- | Schedule a message to be transmitted on the network connection. These -- messages are sent unmodified. The message should contain a newline -- terminator. send :: NetworkConnection -> ByteString -> IO () instance GHC.Show.Show Client.NetworkConnection.NetworkConnection -- | This module provides the tab-completion logic used for nicknames and -- channels. module Client.WordCompletion -- | Perform word completion on a text box. -- -- The leading update operation is applied to the result of -- tab-completion when tab completing from the beginning of the text box. -- This is useful when auto-completing a nick and including a trailing -- colon. -- -- The reversed parameter indicates that tab-completion should -- return the previous entry. wordComplete :: (String -> String) -> Bool -> [Identifier] -> EditBox -> Maybe EditBox instance Client.WordCompletion.Prefix Irc.Identifier.Identifier instance Client.WordCompletion.Prefix Data.Text.Internal.Text instance GHC.Classes.Eq a => Client.WordCompletion.Prefix [a] -- | This module provides smart constructors for IRC commands. module Irc.Commands -- | CAP END command ircCapEnd :: RawIrcMsg -- | CAP LS command ircCapLs :: RawIrcMsg -- | CAP REQ command ircCapReq :: [Text] -> RawIrcMsg -- | INVITE command ircInvite :: Text -> Identifier -> RawIrcMsg -- | JOIN command ircJoin :: Text -> Maybe Text -> RawIrcMsg -- | KICK command ircKick :: Identifier -> Text -> Text -> RawIrcMsg -- | MODE command ircMode :: Identifier -> [Text] -> RawIrcMsg -- | NICK command ircNick :: Identifier -> RawIrcMsg -- | PART command ircPart :: Identifier -> Text -> RawIrcMsg -- | PASS command ircPass :: Text -> RawIrcMsg -- | PONG command ircPong :: [Text] -> RawIrcMsg -- | PRIVMSG command ircPrivmsg :: Identifier -> Text -> RawIrcMsg -- | QUIT command ircQuit :: Text -> RawIrcMsg -- | REMOVE command ircRemove :: Identifier -> Text -> Text -> RawIrcMsg -- | TOPIC command ircTopic :: Identifier -> Text -> RawIrcMsg ircUser :: Text -> Bool -> Bool -> Text -> RawIrcMsg -- | WHO command ircWho :: [Text] -> RawIrcMsg -- | WHOIS command ircWhois :: [Text] -> RawIrcMsg -- | WHOWAS command ircWhowas :: [Text] -> RawIrcMsg -- | This module defines high-level IRC commands. Commands are interpreted -- and their arguments are extracted into the appropriate types. module Irc.Message data IrcMsg UnknownMsg :: RawIrcMsg -> IrcMsg Reply :: Int -> [Text] -> IrcMsg Nick :: UserInfo -> Identifier -> IrcMsg Join :: UserInfo -> Identifier -> IrcMsg Part :: UserInfo -> Identifier -> (Maybe Text) -> IrcMsg Quit :: UserInfo -> (Maybe Text) -> IrcMsg -- | kicker channel kickee comment Kick :: UserInfo -> Identifier -> Identifier -> Text -> IrcMsg -- | user channel topic Topic :: UserInfo -> Identifier -> Text -> IrcMsg -- | source target txt Privmsg :: UserInfo -> Identifier -> Text -> IrcMsg -- | source target txt Action :: UserInfo -> Identifier -> Text -> IrcMsg -- | source target txt Notice :: UserInfo -> Identifier -> Text -> IrcMsg -- | source target txt Mode :: UserInfo -> Identifier -> [Text] -> IrcMsg Cap :: CapCmd -> [Text] -> IrcMsg Ping :: [Text] -> IrcMsg Pong :: [Text] -> IrcMsg Error :: Text -> IrcMsg data CapCmd CapLs :: CapCmd CapList :: CapCmd CapReq :: CapCmd CapAck :: CapCmd CapNak :: CapCmd -- | Interpret a low-level RawIrcMsg as a high-level IrcMsg. -- Messages that can't be understood are wrapped in UnknownMsg. cookIrcMsg :: RawIrcMsg -> IrcMsg -- | Targets used to direct a message to a window for display data MessageTarget -- | Metadata update for a user TargetUser :: !Identifier -> MessageTarget -- | Directed message to channel or from user TargetWindow :: !Identifier -> MessageTarget -- | Network-level message TargetNetwork :: MessageTarget -- | Completely hidden message TargetHidden :: MessageTarget -- | Text representation of an IRC message to be used for matching with -- regular expressions. ircMsgText :: IrcMsg -> Text -- | Target information for the window that could be appropriate to display -- this message in. msgTarget :: Identifier -> IrcMsg -> MessageTarget -- | UserInfo of the user responsible for a message. msgActor :: IrcMsg -> Maybe UserInfo -- | Split a nick into text parts group by whether or not those parts are -- valid nickname characters. nickSplit :: Text -> [Text] -- | Maximum length computation for the message part for privmsg and -- notice. Note that the need for the limit is because the server will -- limit the length of the message sent out to each client, not just the -- length of the messages it will recieve. -- -- Note that the length is on the *encoded message* which is UTF-8 The -- calculation isn't using UTF-8 on the userinfo part because I'm -- assuming that the channel name and userinfo are all ASCII -- --
--   :my!user@info PRIVMSG #channel :messagebodyrn
--   
computeMaxMessageLength :: UserInfo -> Text -> Int instance GHC.Show.Show Irc.Message.IrcMsg instance GHC.Classes.Ord Irc.Message.CapCmd instance GHC.Classes.Eq Irc.Message.CapCmd instance GHC.Show.Show Irc.Message.CapCmd -- | This module provides the type used to track messages just before they -- are added to a window. module Client.Message data ClientMessage ClientMessage :: !Text -> !MessageBody -> !ZonedTime -> ClientMessage [_msgNetwork] :: ClientMessage -> !Text [_msgBody] :: ClientMessage -> !MessageBody [_msgTime] :: ClientMessage -> !ZonedTime msgNetwork :: Lens' ClientMessage Text msgBody :: Lens' ClientMessage MessageBody msgTime :: Lens' ClientMessage ZonedTime data MessageBody IrcBody :: !IrcMsg -> MessageBody ErrorBody :: !String -> MessageBody ExitBody :: MessageBody _IrcBody :: Prism' MessageBody IrcMsg _ErrorBody :: Prism' MessageBody String _ExitBody :: Prism' MessageBody () -- | Compute a searchable text representation of the message msgText :: MessageBody -> Text -- | This module defines types and operations used to store messages for -- display in the client's buffers. module Client.Window -- | A Window tracks all of the messages and metadata for a -- particular message buffer. data Window Window :: ![WindowLine] -> !Int -> !Bool -> Window -- | Messages to display, newest first [_winMessages] :: Window -> ![WindowLine] -- | Messages added since buffer was visible [_winUnread] :: Window -> !Int -- | Indicates an important event is unread [_winMention] :: Window -> !Bool winMessages :: Lens' Window [WindowLine] winUnread :: Lens' Window Int winMention :: Lens' Window Bool -- | A single message to be displayed in a window data WindowLine WindowLine :: !MessageBody -> !Text -> !Image -> !Image -> WindowLine -- | Original Haskell value [_wlBody] :: WindowLine -> !MessageBody -- | Searchable text form [_wlText] :: WindowLine -> !Text -- | Normal rendered image [_wlImage] :: WindowLine -> !Image -- | Detailed rendered image [_wlFullImage] :: WindowLine -> !Image wlBody :: Lens' WindowLine MessageBody wlText :: Lens' WindowLine Text wlImage :: Lens' WindowLine Image wlFullImage :: Lens' WindowLine Image -- | Flag for the important of a message being added to a window data WindowLineImportance -- | Don't update unread count WLBoring :: WindowLineImportance -- | Increment unread count WLNormal :: WindowLineImportance -- | Increment unread count and set important flag WLImportant :: WindowLineImportance -- | A window with no messages emptyWindow :: Window -- | Adds a given line to a window as the newest message. Window's unread -- count will be updated according to the given importance. addToWindow :: WindowLineImportance -> WindowLine -> Window -> Window -- | Update the window clearing the unread count and important flag. windowSeen :: Window -> Window instance GHC.Show.Show Client.Window.WindowLineImportance instance GHC.Classes.Eq Client.Window.WindowLineImportance -- | This module provides the color mapping for nick highlighting. module Client.IdentifierColors -- | Compute a color from the denotation of an identifier. This color will -- be consistent for different capitalizations and will be consistent -- across program executions. identifierColor :: Identifier -> Color -- | This module provides image renderers for messages. module Client.Image.Message -- | Parameters used when rendering messages data MessageRendererParams MessageRendererParams :: [Char] -> [Char] -> [Identifier] -> MessageRendererParams -- | restricted message sigils [rendStatusMsg] :: MessageRendererParams -> [Char] -- | sender sigils [rendUserSigils] :: MessageRendererParams -> [Char] -- | nicknames to highlight [rendNicks] :: MessageRendererParams -> [Identifier] -- | Level of detail to use when rendering data RenderMode -- | only render nicknames NormalRender :: RenderMode -- | render full user info DetailedRender :: RenderMode -- | Default MessageRenderParams with no sigils or nicknames -- specified defaultRenderParams :: MessageRendererParams -- | Construct a message given the time the message was received and its -- render parameters. msgImage :: ZonedTime -> MessageRendererParams -> MessageBody -> Image -- | Construct a message given the time the message was received and its -- render parameters using a detailed view. detailedMsgImage :: ZonedTime -> MessageRendererParams -> MessageBody -> Image -- | Returns image and identifier to be used when collapsing metadata -- messages. metadataImg :: IrcMsg -> Maybe (Image, Maybe Identifier) -- | Image used when treating ignored chat messages as metadata ignoreImage :: Image -- | Render an identifier without using colors. This is useful for -- metadata. quietIdentifier :: Identifier -> Image -- | Render an a full user. In normal mode only the nickname will be -- rendered. If detailed mode the full user info including the username -- and hostname parts will be rendered. The nickname will be colored. coloredUserInfo :: RenderMode -> UserInfo -> Image -- | Render a nickname in its hash-based color. coloredIdentifier :: Identifier -> Image -- | This module is responsible for tracking the state of an individual IRC -- channel while the client is connected to it. When the client joins a -- channel a new channel session is created and when the client leaves a -- channel is it destroyed. module Client.ChannelState data ChannelState chanTopic :: Lens' ChannelState Text chanTopicProvenance :: Lens' ChannelState (Maybe TopicProvenance) chanUsers :: Lens' ChannelState (HashMap Identifier String) chanModes :: Lens' ChannelState (Map Char Text) chanLists :: Lens' ChannelState (Map Char (HashMap Text (Text, UTCTime))) -- | Lens into a mask list for a given mode. chanList :: Functor f => Char -> LensLike' f ChannelState (HashMap Text (Text, UTCTime)) chanCreation :: Lens' ChannelState (Maybe UTCTime) chanQueuedModeration :: Lens' ChannelState [RawIrcMsg] data TopicProvenance TopicProvenance :: !UserInfo -> !UTCTime -> TopicProvenance [_topicAuthor] :: TopicProvenance -> !UserInfo [_topicTime] :: TopicProvenance -> !UTCTime topicAuthor :: Lens' TopicProvenance UserInfo topicTime :: Lens' TopicProvenance UTCTime -- | Construct an empty ChannelState newChannel :: ChannelState -- | Set the channel topic setTopic :: Text -> ChannelState -> ChannelState -- | Add a user to the user list joinChannel :: Identifier -> ChannelState -> ChannelState -- | Remove a user from the user list partChannel :: Identifier -> ChannelState -> ChannelState -- | Rename a user in the user list nickChange :: Identifier -> Identifier -> ChannelState -> ChannelState instance GHC.Show.Show Client.ChannelState.ChannelState instance GHC.Show.Show Client.ChannelState.TopicProvenance -- | This module is responsible for tracking the state of an individual IRC -- connection while the client is connected to it. This state includes -- user information, server settings, channel membership, and more. -- -- This module is more complicated than many of the other modules in the -- client because it is responsible for interpreting each IRC message -- from the server and updating the connection state accordingly. module Client.ConnectionState data ConnectionState csNick :: Lens' ConnectionState Identifier csChannels :: Lens' ConnectionState (HashMap Identifier ChannelState) csSocket :: Lens' ConnectionState NetworkConnection csModeTypes :: Lens' ConnectionState ModeTypes csChannelTypes :: Lens' ConnectionState [Char] csTransaction :: Lens' ConnectionState Transaction csModes :: Lens' ConnectionState [Char] csStatusMsg :: Lens' ConnectionState [Char] csSettings :: Lens' ConnectionState ServerSettings csUserInfo :: Lens' ConnectionState UserInfo csUsers :: Lens' ConnectionState (HashMap Identifier (Maybe Text, Maybe Text)) csUser :: Functor f => Identifier -> LensLike' f ConnectionState (Maybe Text, Maybe Text) csModeCount :: Lens' ConnectionState Int csNetworkId :: Lens' ConnectionState NetworkId csNetwork :: Lens' ConnectionState Text csNextPingTime :: Lens' ConnectionState (Maybe UTCTime) csPingStatus :: Lens' ConnectionState PingStatus newConnectionState :: NetworkId -> Text -> ServerSettings -> NetworkConnection -> ConnectionState isChannelIdentifier :: ConnectionState -> Identifier -> Bool -- | Predicate to test if the connection has op in a given channel. iHaveOp :: Identifier -> ConnectionState -> Bool sendMsg :: ConnectionState -> RawIrcMsg -> IO () initialMessages :: ConnectionState -> [RawIrcMsg] applyMessage :: ZonedTime -> IrcMsg -> ConnectionState -> ([RawIrcMsg], ConnectionState) -- | Return True for messages that should be hidden outside of full -- detail view. These messages are interpreted by the client so the user -- shouldn't need to see them directly to get the relevant information. squelchIrcMsg :: IrcMsg -> Bool data PingStatus PingSent :: !UTCTime -> PingStatus PingLatency :: !Double -> PingStatus PingNever :: PingStatus data TimedAction TimedDisconnect :: TimedAction TimedSendPing :: TimedAction nextTimedAction :: ConnectionState -> Maybe (UTCTime, TimedAction) instance GHC.Show.Show Client.ConnectionState.TimedAction instance GHC.Classes.Ord Client.ConnectionState.TimedAction instance GHC.Classes.Eq Client.ConnectionState.TimedAction instance GHC.Show.Show Client.ConnectionState.ConnectionState instance GHC.Show.Show Client.ConnectionState.Transaction instance GHC.Show.Show Client.ConnectionState.PingStatus -- | This module defines the top-level configuration information for the -- client. module Client.Configuration -- | Top-level client configuration information. When connecting to a -- server configuration from _configServers is used where -- possible, otherwise _configDefaults is used. data Configuration Configuration :: ServerSettings -> HashMap HostName ServerSettings -> Configuration -- | Default connection settings [_configDefaults] :: Configuration -> ServerSettings -- | Host-specific settings [_configServers] :: Configuration -> HashMap HostName ServerSettings configDefaults :: Lens' Configuration ServerSettings configServers :: Lens' Configuration (HashMap HostName ServerSettings) -- | Load the configuration file defaulting to -- ~.glircconfig. This action can throw IOError -- and ConfigurationFailure exceptions. loadConfiguration :: Maybe FilePath -> IO Configuration instance GHC.Show.Show Client.Configuration.ConfigurationFailure instance GHC.Exception.Exception Client.Configuration.ConfigurationFailure instance GHC.Show.Show Client.Configuration.Configuration -- | This module provides the core logic of the IRC client. The client -- state tracks everything about the client. module Client.State type NetworkName = Text -- | All state information for the IRC client data ClientState ClientState :: !(Map ClientFocus Window) -> !ClientFocus -> !ClientSubfocus -> !(IntMap ConnectionState) -> !Int -> !ConnectionContext -> !(TQueue NetworkEvent) -> !(HashMap NetworkName NetworkId) -> !Vty -> !EditBox -> !Int -> !Int -> !Configuration -> !Int -> !Bool -> !(HashSet Identifier) -> ClientState -- | client message buffers [_clientWindows] :: ClientState -> !(Map ClientFocus Window) -- | currently focused buffer [_clientFocus] :: ClientState -> !ClientFocus -- | sec [_clientSubfocus] :: ClientState -> !ClientSubfocus -- | state of active connections [_clientConnections] :: ClientState -> !(IntMap ConnectionState) [_clientNextConnectionId] :: ClientState -> !Int -- | network connection context [_clientConnectionContext] :: ClientState -> !ConnectionContext -- | incoming network event queue [_clientEvents] :: ClientState -> !(TQueue NetworkEvent) -- | network name to connection ID [_clientNetworkMap] :: ClientState -> !(HashMap NetworkName NetworkId) -- | VTY handle [_clientVty] :: ClientState -> !Vty -- | primary text box [_clientTextBox] :: ClientState -> !EditBox -- | current terminal width [_clientWidth] :: ClientState -> !Int -- | current terminal height [_clientHeight] :: ClientState -> !Int -- | client configuration [_clientConfig] :: ClientState -> !Configuration -- | buffer scroll lines [_clientScroll] :: ClientState -> !Int -- | use detailed rendering mode [_clientDetailView] :: ClientState -> !Bool -- | ignored nicknames [_clientIgnores] :: ClientState -> !(HashSet Identifier) clientWindows :: Lens' ClientState (Map ClientFocus Window) clientTextBox :: Lens' ClientState EditBox clientConnections :: Lens' ClientState (IntMap ConnectionState) clientWidth :: Lens' ClientState Int clientHeight :: Lens' ClientState Int clientEvents :: Lens' ClientState (TQueue NetworkEvent) clientVty :: Lens' ClientState Vty clientFocus :: Lens' ClientState ClientFocus clientConnectionContext :: Lens' ClientState ConnectionContext clientConfig :: Lens' ClientState Configuration clientScroll :: Lens' ClientState Int clientDetailView :: Lens' ClientState Bool clientSubfocus :: Lens' ClientState ClientSubfocus clientNextConnectionId :: Lens' ClientState Int clientNetworkMap :: Lens' ClientState (HashMap NetworkName NetworkId) clientIgnores :: Lens' ClientState (HashSet Identifier) clientConnection :: Applicative f => NetworkName -> LensLike' f ClientState ConnectionState initialClientState :: Configuration -> Vty -> IO ClientState clientMatcher :: ClientState -> Text -> Bool consumeInput :: ClientState -> ClientState currentUserList :: ClientState -> [Identifier] -- | Predicate for messages that should be ignored based on the -- configurable ignore list ircIgnorable :: IrcMsg -> ClientState -> Maybe Identifier clientInput :: ClientState -> String abortNetwork :: NetworkName -> ClientState -> IO ClientState addConnection :: Text -> ClientState -> IO ClientState -- | Remove a network connection and unlink it from the network map. This -- operation assumes that the networkconnection exists and should only be -- applied once per connection. removeNetwork :: NetworkId -> ClientState -> (ConnectionState, ClientState) clientTick :: ClientState -> IO ClientState recordChannelMessage :: NetworkName -> Identifier -> ClientMessage -> ClientState -> ClientState recordNetworkMessage :: ClientMessage -> ClientState -> ClientState recordIrcMessage :: NetworkName -> MessageTarget -> ClientMessage -> ClientState -> ClientState data ClientFocus Unfocused :: ClientFocus NetworkFocus :: !NetworkName -> ClientFocus ChannelFocus :: !NetworkName -> !Identifier -> ClientFocus data ClientSubfocus FocusMessages :: ClientSubfocus FocusUsers :: ClientSubfocus FocusMasks :: !Char -> ClientSubfocus focusNetwork :: ClientFocus -> Maybe NetworkName changeFocus :: ClientFocus -> ClientState -> ClientState changeSubfocus :: ClientSubfocus -> ClientState -> ClientState advanceFocus :: ClientState -> ClientState retreatFocus :: ClientState -> ClientState windowNames :: [Char] instance GHC.Classes.Eq Client.State.ClientSubfocus instance GHC.Classes.Eq Client.State.ClientFocus instance GHC.Classes.Ord Client.State.ClientFocus -- | This module process command-line arguments provided when launching the -- client. module Client.CommandArguments -- | Command-line arguments data CommandArguments CommandArguments :: Maybe FilePath -> [NetworkName] -> Bool -> Bool -> CommandArguments -- | configuration file path [_cmdArgConfigFile] :: CommandArguments -> Maybe FilePath -- | initial networks [_cmdArgInitialNetworks] :: CommandArguments -> [NetworkName] -- | show help message [_cmdArgShowHelp] :: CommandArguments -> Bool -- | show version message [_cmdArgShowVersion] :: CommandArguments -> Bool cmdArgConfigFile :: Lens' CommandArguments (Maybe FilePath) cmdArgInitialNetworks :: Lens' CommandArguments [NetworkName] -- | Load command line arguments. This action will terminate early in the -- case of the version flag, help flag, or an error. getCommandArguments :: IO CommandArguments -- | This module renders the lines used in the channel mask list. A mask -- list can show channel bans, quiets, invites, and exceptions. module Client.Commands -- | Possible results of running a command data CommandResult -- | Continue running client with updated state CommandContinue :: ClientState -> CommandResult -- | Client should close CommandQuit :: CommandResult -- | Parse and execute the given command. When the first argument is -- Nothing the command is executed, otherwise the first argument is the -- cursor position for tab-completion executeCommand :: Maybe Bool -> String -> ClientState -> IO CommandResult -- | Complete the nickname at the current cursor position using the -- userlist for the currently focused channel (if any) nickTabCompletion :: Bool -> ClientState -> ClientState -- | This module renders the lines used in the channel mask list. A mask -- list can show channel bans, quiets, invites, and exceptions. module Client.Image.MaskList -- | Render the lines used in a channel mask list maskListImages :: Char -> NetworkName -> Identifier -> ClientState -> [Image] -- | This module renders the lines used in the channel user list. module Client.Image.UserList -- | Render the lines used in a simple user list window. userListImages :: NetworkName -> Identifier -> ClientState -> [Image] -- | Render lines for detailed channel user list which shows full user -- info. userInfoImages :: NetworkName -> Identifier -> ClientState -> [Image] -- | This module provides the renderer for the client's UI. module Client.Image -- | Generate a Picture for the current client state. The resulting -- client state is updated for render specific information like -- scrolling. clientPicture :: ClientState -> (Picture, ClientState) -- | This module is responsible for dispatching user-input, network, and -- timer events to the correct module. It renders the user interface once -- per event. module Client.EventLoop -- | Apply this function to an initial ClientState to launch the -- client. eventLoop :: ClientState -> IO () -- | Entry point into glirc2. This module sets up VTY and launches the -- client. module Main -- | Initialize a Vty value and run a continuation. Shutdown the -- Vty once the continuation finishes. withVty :: (Vty -> IO a) -> IO a -- | Main action for IRC client main :: IO () -- | Create connections for all the networks on the command line. Set the -- client focus to the first network listed. addInitialNetworks :: [NetworkName] -> ClientState -> IO ClientState