-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Console IRC client -- -- Console IRC client -- -- glirc is a console IRC client with an emphasis on providing dynamic -- views into the model of your IRC connections. -- -- Documentation Wiki @package glirc @version 2.25 -- | Implementation of ECDSA-NIST256P-CHALLENGE SASL authentication mode as -- implemented at https://github.com/kaniini/ecdsatool and used on -- Freenode. -- -- Using this mode requires that the ecdsa utility program is -- available in your search path. module Client.Authentication.Ecdsa -- | Identifier for SASL ECDSA challenge response authentication using -- curve NIST256P. -- --
-- ECDSA-NIST256P-CHALLENGE --authenticationMode :: Text -- | Encode a username as specified in this authentication mode. encodeUsername :: Text -> Text -- | Compute the response for a given challenge using the -- ecdsatool executable which must be available in -- PATH. computeResponse :: FilePath -> Text -> IO (Either String Text) -- | Marshaling types and functions for the C API module Client.CApi.Types -- |
-- struct glirc_extension; --data FgnExtension FgnExtension :: FunPtr StartExtension -> FunPtr StopExtension -> FunPtr ProcessMessage -> FunPtr ProcessChat -> FunPtr ProcessCommand -> CString -> CInt -> FgnExtension -- | Optional startup callback [fgnStart] :: FgnExtension -> FunPtr StartExtension -- | Optional shutdown callback [fgnStop] :: FgnExtension -> FunPtr StopExtension -- | Optional message received callback [fgnMessage] :: FgnExtension -> FunPtr ProcessMessage -- | Optional message send callback [fgnChat] :: FgnExtension -> FunPtr ProcessChat -- | Optional client command callback [fgnCommand] :: FgnExtension -> FunPtr ProcessCommand -- | Null-terminated name [fgnName] :: FgnExtension -> CString -- | extension version -- | extension version [fgnMajorVersion, fgnMinorVersion] :: FgnExtension -> CInt -- |
-- typedef void *start(void *glirc, const char *path); --type StartExtension = Ptr () api token -> CString path to extension -> IO (Ptr ()) initialized extension state -- |
-- typedef void stop(void *glirc, void *S); --type StopExtension = Ptr () api token -> Ptr () extension state -> IO () -- |
-- typedef enum process_result process_message(void *glirc, void *S, const struct glirc_message *); --type ProcessMessage = Ptr () api token -> Ptr () extention state -> Ptr FgnMsg message to send -> IO MessageResult -- |
-- typedef void process_command(void *glirc, void *S, const struct glirc_command *); --type ProcessCommand = Ptr () api token -> Ptr () extension state -> Ptr FgnCmd command -> IO () -- |
-- struct glirc_string --data FgnStringLen FgnStringLen :: !CString -> !CSize -> FgnStringLen -- |
-- struct glirc_message --data FgnMsg FgnMsg :: FgnStringLen -> FgnStringLen -> FgnStringLen -> FgnStringLen -> FgnStringLen -> Ptr FgnStringLen -> CSize -> Ptr FgnStringLen -> Ptr FgnStringLen -> CSize -> FgnMsg [fmNetwork] :: FgnMsg -> FgnStringLen [fmPrefixNick] :: FgnMsg -> FgnStringLen [fmPrefixUser] :: FgnMsg -> FgnStringLen [fmPrefixHost] :: FgnMsg -> FgnStringLen [fmCommand] :: FgnMsg -> FgnStringLen -- | array [fmParams] :: FgnMsg -> Ptr FgnStringLen -- | array length [fmParamN] :: FgnMsg -> CSize -- | array [fmTagKeys] :: FgnMsg -> Ptr FgnStringLen -- | array [fmTagVals] :: FgnMsg -> Ptr FgnStringLen -- | array length [fmTagN] :: FgnMsg -> CSize -- |
-- struct glirc_command --data FgnCmd FgnCmd :: FgnStringLen -> FgnCmd [fcCommand] :: FgnCmd -> FgnStringLen -- |
-- struct glirc_message --data FgnChat FgnChat :: FgnStringLen -> FgnStringLen -> FgnStringLen -> FgnChat [fhNetwork] :: FgnChat -> FgnStringLen [fhTarget] :: FgnChat -> FgnStringLen [fhMessage] :: FgnChat -> FgnStringLen -- | Type of dynamic function pointer wrappers. type Dynamic a = FunPtr a -> a runStartExtension :: Dynamic StartExtension runStopExtension :: Dynamic StopExtension runProcessMessage :: Dynamic ProcessMessage runProcessCommand :: Dynamic ProcessCommand runProcessChat :: Dynamic ProcessChat -- | Tag for describing the kind of message to display in the client as -- used in glirc_print. -- --
-- enum message_code; --newtype MessageCode MessageCode :: CInt -> MessageCode normalMessage :: MessageCode -- | Result used to determine what to do after processing a message with -- the ProcessMessage callback. -- --
-- enum process_result; --errorMessage :: MessageCode newtype MessageResult MessageResult :: CInt -> MessageResult passMessage :: MessageResult dropMessage :: MessageResult -- | Marshal a text as a temporary null-terminated CStringLen withText0 :: Text -> (CStringLen -> IO a) -> IO a -- | Marshal a text as a malloced null-terminated CStringLen exportText :: Ptr CString -> Ptr CSize -> Text -> IO () -- | Like poke except it doesn't write to NULL poke' :: Storable a => Ptr a -> a -> IO () instance GHC.Classes.Eq Client.CApi.Types.MessageResult instance GHC.Classes.Eq Client.CApi.Types.MessageCode instance Foreign.Storable.Storable Client.CApi.Types.FgnExtension instance Foreign.Storable.Storable Client.CApi.Types.FgnMsg instance Foreign.Storable.Storable Client.CApi.Types.FgnChat instance Foreign.Storable.Storable Client.CApi.Types.FgnCmd instance Foreign.Storable.Storable Client.CApi.Types.FgnStringLen -- | Foreign interface to the IRC client via a simple C API and dynamically -- loaded modules. module Client.CApi -- | Information about a loaded extension including the handle to the -- loaded shared object, and state value returned by the startup -- callback, and the loaded extension record. data ActiveExtension ActiveExtension :: !FgnExtension -> !DL -> !(Ptr ()) -> !Text -> !Int -> ActiveExtension -- | Struct of callback function pointers [aeFgn] :: ActiveExtension -> !FgnExtension -- | Handle of dynamically linked extension [aeDL] :: ActiveExtension -> !DL -- | State value generated by start callback [aeSession] :: ActiveExtension -> !(Ptr ()) [aeName] :: ActiveExtension -> !Text [aeMajorVersion, aeMinorVersion] :: ActiveExtension -> !Int -- | The symbol that is loaded from an extension object. -- -- Extensions are expected to export: -- --
-- struct galua_extension extension; --extensionSymbol :: String -- | Load the extension from the given path and call the start callback. -- The result of the start callback is saved to be passed to any -- subsequent calls into the extension. activateExtension :: Ptr () -> FilePath -> IO ActiveExtension -- | Call the stop callback of the extension if it is defined and unload -- the shared object. deactivateExtension :: Ptr () -> ActiveExtension -> IO () -- | Call all of the process message callbacks in the list of extensions. -- This operation marshals the IRC message once and shares that across -- all of the callbacks. -- -- Returns True to pass message to client. Returns 'False to drop -- message. notifyExtensions :: Ptr () -> Text -> RawIrcMsg -> [ActiveExtension] -> IO Bool -- | Notify an extension of a client command with the given parameters. commandExtension :: Ptr () -> Text -> ActiveExtension -> IO () -- | Call all of the process chat callbacks in the list of extensions. This -- operation marshals the IRC message once and shares that across all of -- the callbacks. -- -- Returns True to pass message to client. Returns 'False to drop -- message. chatExtension :: Ptr () -> Text -> Text -> Text -> [ActiveExtension] -> IO Bool instance Control.Monad.IO.Class.MonadIO Client.CApi.NestedIO instance GHC.Base.Monad Client.CApi.NestedIO instance GHC.Base.Applicative Client.CApi.NestedIO instance GHC.Base.Functor Client.CApi.NestedIO module Client.Commands.Arguments.Spec type Args r = Ap (Arg r) simpleToken :: String -> Args r String remainingArg :: String -> Args r String optionalArg :: Args r a -> Args r (Maybe a) tokenList :: [String] -> [String] -> Args r [String] numberArg :: Args r Int extensionArg :: String -> (r -> String -> Maybe (Args r a)) -> Args r a data ArgumentShape TokenArgument :: ArgumentShape RemainingArgument :: ArgumentShape data Arg :: * -> * -> * [Argument] :: ArgumentShape -> String -> (r -> String -> Maybe a) -> Arg r a [Optional] :: Args r a -> Arg r (Maybe a) [Extension] :: String -> (r -> String -> Maybe (Args r a)) -> Arg r a module Client.Commands.Arguments.Parser parse :: r -> Args r a -> String -> Maybe a -- | 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.Exec -- | Settings for /exec command. -- -- When no network or channel are specified the output is sent to the -- client window. -- -- When only a network is specified the output is sent as raw IRC -- commands to that network. -- -- When only a channel is specified the output is sent as messages on the -- current network to the given channel. -- -- When the network and channel are specified the output is sent as -- messages to the given channel on the given network. data ExecCmd ExecCmd :: Maybe String -> Maybe String -> String -> String -> [String] -> ExecCmd -- | output network [_execOutputNetwork] :: ExecCmd -> Maybe String -- | output channel [_execOutputChannel] :: ExecCmd -> Maybe String -- | command filename [_execCommand] :: ExecCmd -> String -- | stdin source [_execStdIn] :: ExecCmd -> String -- | command arguments [_execArguments] :: ExecCmd -> [String] execOutputNetwork :: Lens' ExecCmd (Maybe String) execOutputChannel :: Lens' ExecCmd (Maybe String) -- | Parse the arguments to /exec looking for various flags and -- the command and its arguments. parseExecCmd :: String -> Either [String] ExecCmd -- | Execute the requested command synchronously and return the output. runExecCmd :: ExecCmd -> IO (Either [String] [String]) instance GHC.Show.Show Client.Commands.Exec.ExecCmd instance GHC.Read.Read Client.Commands.Exec.ExecCmd -- | This module is able to parse commands with inline variables and then -- to evaluate those variables to produce a complete command that varies -- by the current context. module Client.Commands.Interpolation -- | Parsed chunk of an expandable command data ExpansionChunk -- | regular text LiteralChunk :: Text -> ExpansionChunk -- | inline variable $x or ${x y} VariableChunk :: Text -> ExpansionChunk -- | inline variable $1 or ${1} IntegerChunk :: Integer -> ExpansionChunk -- | bracketed variable with default ${x|lit} DefaultChunk :: ExpansionChunk -> Text -> ExpansionChunk -- | Parse a Text searching for the expansions as specified in -- ExpansionChunk. $$ is used to escape a single -- $. parseExpansion :: Text -> Maybe [ExpansionChunk] -- | Attempt to expand all of the elements in the given list using the two -- expansion functions. If the expansion of any chunk fails the whole -- expansion fails. resolveMacroExpansions :: (Text -> Maybe Text) -> (Integer -> Maybe Text) -> [ExpansionChunk] -> Maybe Text data Macro Macro :: MacroSpec -> [[ExpansionChunk]] -> Macro [macroSpec] :: Macro -> MacroSpec [macroCommands] :: Macro -> [[ExpansionChunk]] data MacroSpec [MacroSpec] :: (forall r. Args r [String]) -> MacroSpec parseMacroSpecs :: Text -> Maybe MacroSpec -- | Specification used when unspecified, no arguments. noMacroArguments :: MacroSpec instance GHC.Show.Show Client.Commands.Interpolation.Macro instance GHC.Show.Show Client.Commands.Interpolation.ExpansionChunk instance GHC.Show.Show Client.Commands.Interpolation.MacroSpec -- | This module implements a trie for recognizing valid commands. This -- allows entered strings to be classified as either a valid command -- (with an associated value), the prefix of a valid command, or invalid. module Client.Commands.Recognizer -- | A map from Text values to a values that is capable of -- yielding more detailed information when looking up keys that are not -- actually in the map. data Recognizer a -- | Attempt to recognize a string, yielding a Recognition result. recognize :: Text -> Recognizer a -> Recognition a -- | Possible results of recognizing text. data Recognition a -- | text matched exactly, yielding the given value Exact :: a -> Recognition a -- | text would be recognized if joined to the given suffixes Prefix :: [Text] -> Recognition a -- | text could not possibly be recognized Invalid :: Recognition a -- | Create a Recognizer from an association list. If a key appears -- twice, the earliest associated value will be used. fromCommands :: [(Text, a)] -> Recognizer a -- | Add a key-value pair to a Recognizer. This will override the -- value already present if one exists. addCommand :: Text -> a -> Recognizer a -> Recognizer a -- | Compute all strings that will be recognized by a Recognizer. keys :: Recognizer a -> [Text] instance GHC.Base.Functor Client.Commands.Recognizer.Recognition instance GHC.Show.Show a => GHC.Show.Show (Client.Commands.Recognizer.Recognition a) instance GHC.Base.Functor Client.Commands.Recognizer.Recognizer instance GHC.Show.Show a => GHC.Show.Show (Client.Commands.Recognizer.Recognizer a) instance GHC.Base.Monoid (Client.Commands.Recognizer.Recognizer a) instance Data.Semigroup.Semigroup (Client.Commands.Recognizer.Recognizer a) -- | This module defines the top-level configuration information for the -- client. module Client.Configuration.Colors -- | Parse a color. Support formats are: -- --
-- toString (fromString x) == x -- fromString (toString x) == x -- isPrefix x y ==> x <= y --class (IsString a, Ord a) => Prefix a -- | Check if the first argument is a lexicographic prefix of the second. isPrefix :: Prefix a => a -> a -> Bool -- | Convert to a String. toString :: Prefix a => a -> String -- | 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. When starting a fresh tab completion the -- priority completions will be considered in order before resorting to -- the set of possible completions. wordComplete :: Prefix a => WordCompletionMode -> Bool -> [a] -> [a] -> EditBox -> Maybe EditBox -- | Word completion prefix and suffix data WordCompletionMode WordCompletionMode :: String -> WordCompletionMode [wcmStartPrefix, wcmStartSuffix, wcmMiddlePrefix, wcmMiddleSuffix] :: WordCompletionMode -> String -- | Word completion without adding any prefix or suffix plainWordCompleteMode :: WordCompletionMode -- | Word completion adding a ": " suffix at the beginning of lines defaultNickWordCompleteMode :: WordCompletionMode -- | Word completion using a "@" prefix intended slackNickWordCompleteMode :: WordCompletionMode instance GHC.Show.Show Client.Commands.WordCompletion.WordCompletionMode instance Client.Commands.WordCompletion.Prefix Irc.Identifier.Identifier instance Client.Commands.WordCompletion.Prefix Data.Text.Internal.Text -- | 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.Configuration.ServerSettings -- | Static server-level settings data ServerSettings ServerSettings :: !(NonEmpty Text) -> !Text -> !Text -> !Text -> !(Maybe Text) -> !(Maybe Text) -> !(Maybe Text) -> !(Maybe FilePath) -> !HostName -> !(Maybe PortNumber) -> !UseTls -> !(Maybe FilePath) -> !(Maybe FilePath) -> !(Maybe FilePath) -> String -> ![[ExpansionChunk]] -> !(Maybe HostName) -> !PortNumber -> ![Identifier] -> !Rational -> !Rational -> ![Text] -> !(Maybe Text) -> !Int -> Bool -> WordCompletionMode -> Maybe FilePath -> Maybe Family -> ServerSettings -- | connection nicknames [_ssNicks] :: ServerSettings -> !(NonEmpty 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 plain password [_ssSaslPassword] :: ServerSettings -> !(Maybe Text) -- | SASL ecdsa private key [_ssSaslEcdsaFile] :: ServerSettings -> !(Maybe FilePath) -- | server hostname [_ssHostName] :: ServerSettings -> !HostName -- | server port [_ssPort] :: ServerSettings -> !(Maybe PortNumber) -- | use TLS to connect [_ssTls] :: ServerSettings -> !UseTls -- | path to client TLS certificate [_ssTlsClientCert] :: ServerSettings -> !(Maybe FilePath) -- | path to client TLS key [_ssTlsClientKey] :: ServerSettings -> !(Maybe FilePath) -- | additional CA certificates for validating server [_ssTlsServerCert] :: ServerSettings -> !(Maybe FilePath) -- | OpenSSL cipher suite [_ssTlsCiphers] :: ServerSettings -> String -- | commands to execute upon successful connection [_ssConnectCmds] :: ServerSettings -> ![[ExpansionChunk]] -- | hostname of SOCKS proxy [_ssSocksHost] :: ServerSettings -> !(Maybe HostName) -- | port of SOCKS proxy [_ssSocksPort] :: ServerSettings -> !PortNumber -- | Channels with chanserv permissions [_ssChanservChannels] :: ServerSettings -> ![Identifier] -- | Flood limiter penalty (seconds) [_ssFloodPenalty] :: ServerSettings -> !Rational -- | Flood limited threshold (seconds) [_ssFloodThreshold] :: ServerSettings -> !Rational -- | Initial message hooks [_ssMessageHooks] :: ServerSettings -> ![Text] -- | The name referencing the server in commands [_ssName] :: ServerSettings -> !(Maybe Text) -- | The number of reconnect attempts to make on error [_ssReconnectAttempts] :: ServerSettings -> !Int -- | Connect to this network on server startup [_ssAutoconnect] :: ServerSettings -> Bool -- | Nick completion mode for this server [_ssNickCompletion] :: ServerSettings -> WordCompletionMode -- | Directory to save logs of chat [_ssLogDir] :: ServerSettings -> Maybe FilePath -- | Protocol family to connect with [_ssProtocolFamily] :: ServerSettings -> Maybe Family serverSpec :: ValueSpecs (ServerSettings -> ServerSettings) identifierSpec :: ValueSpecs Identifier ssNicks :: Lens' ServerSettings (NonEmpty 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) ssSaslEcdsaFile :: Lens' ServerSettings (Maybe FilePath) ssHostName :: Lens' ServerSettings HostName ssPort :: Lens' ServerSettings (Maybe PortNumber) ssTls :: Lens' ServerSettings UseTls ssTlsClientCert :: Lens' ServerSettings (Maybe FilePath) ssTlsClientKey :: Lens' ServerSettings (Maybe FilePath) ssTlsServerCert :: Lens' ServerSettings (Maybe FilePath) ssTlsCiphers :: Lens' ServerSettings String ssConnectCmds :: Lens' ServerSettings [[ExpansionChunk]] ssSocksHost :: Lens' ServerSettings (Maybe HostName) ssSocksPort :: Lens' ServerSettings PortNumber ssChanservChannels :: Lens' ServerSettings [Identifier] ssFloodPenalty :: Lens' ServerSettings Rational ssFloodThreshold :: Lens' ServerSettings Rational ssMessageHooks :: Lens' ServerSettings [Text] ssName :: Lens' ServerSettings (Maybe Text) ssReconnectAttempts :: Lens' ServerSettings Int ssAutoconnect :: Lens' ServerSettings Bool ssNickCompletion :: Lens' ServerSettings WordCompletionMode ssLogDir :: Lens' ServerSettings (Maybe FilePath) ssProtocolFamily :: Lens' ServerSettings (Maybe Family) -- | Load the defaults for server settings based on the environment -- variables. -- -- Environment variables USER, IRCPASSSWORD, and -- SASLPASSWORD are used. loadDefaultServerSettings :: IO ServerSettings -- | Security setting for network connection data UseTls -- | TLS connection UseTls :: UseTls -- | TLS connection without certificate checking UseInsecureTls :: UseTls -- | Plain connection UseInsecure :: UseTls instance GHC.Show.Show Client.Configuration.ServerSettings.ServerSettings instance GHC.Show.Show Client.Configuration.ServerSettings.UseTls -- | 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.Network.Connect -- | Create a new Connection which will be closed when the -- continuation finishes. withConnection :: 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.Network.Async -- | 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 successful connection to host NetworkOpen :: !NetworkId -> !ZonedTime -> 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 :: Int -> NetworkId -> ServerSettings -> TQueue NetworkEvent -> IO NetworkConnection -- | 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 () -- | Force the given connection to terminate. abortConnection :: TerminationReason -> NetworkConnection -> IO () -- | Exceptions used to kill connections manually. data TerminationReason -- | sent when ping timer expires PingTimeout :: TerminationReason -- | sent when client commands force disconnect ForcedDisconnect :: TerminationReason instance GHC.Show.Show Client.Network.Async.TerminationReason instance GHC.Exception.Exception Client.Network.Async.TerminationReason instance GHC.Show.Show Client.Network.Async.NetworkConnection -- | 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 Text ServerSettings) -> Palette -> Text -> HashSet Identifier -> PaddingMode -> Recognizer Macro -> [FilePath] -> Maybe FilePath -> [Text] -> Bool -> Bool -> Bool -> KeyMap -> LayoutMode -> [Modifier] -> Configuration -- | Default connection settings [_configDefaults] :: Configuration -> ServerSettings -- | Host-specific settings [_configServers] :: Configuration -> (HashMap Text ServerSettings) [_configPalette] :: Configuration -> Palette -- | Names of windows, used when alt-jumping) [_configWindowNames] :: Configuration -> Text -- | Extra highlight nicks/terms [_configExtraHighlights] :: Configuration -> HashSet Identifier -- | Padding of nicks in messages [_configNickPadding] :: Configuration -> PaddingMode -- | command macros [_configMacros] :: Configuration -> Recognizer Macro -- | paths to shared library [_configExtensions] :: Configuration -> [FilePath] -- | paths to url opening executable [_configUrlOpener] :: Configuration -> Maybe FilePath -- | initial ignore mask list [_configIgnores] :: Configuration -> [Text] -- | initially visibility of the activity bar [_configActivityBar] :: Configuration -> Bool -- | notify terminal on mention [_configBellOnMention] :: Configuration -> Bool -- | default setting for hidemeta on new windows [_configHideMeta] :: Configuration -> Bool -- | keyboard bindings [_configKeyMap] :: Configuration -> KeyMap -- | Default layout on startup [_configLayout] :: Configuration -> LayoutMode -- | Modifier used for jumping windows [_configJumpModifier] :: Configuration -> [Modifier] -- | Failure cases when loading a configuration file. data ConfigurationFailure -- | Error message from reading configuration file ConfigurationReadFailed :: String -> ConfigurationFailure -- | Error message from parser or lexer ConfigurationParseFailed :: FilePath -> String -> ConfigurationFailure -- | Error message from loading parsed configuration ConfigurationMalformed :: FilePath -> String -> ConfigurationFailure data LayoutMode -- | Vertically stack all windows in a single column OneColumn :: LayoutMode -- | Vertically stack extra windows in a second column TwoColumn :: LayoutMode -- | Setting for how to pad the message prefix. data PaddingMode -- | Whitespace add to the left side of chat prefix LeftPadding :: !Int -> PaddingMode -- | Whitespace add to the right side of chat prefix RightPadding :: !Int -> PaddingMode -- | No whitespace added NoPadding :: PaddingMode configDefaults :: Lens' Configuration ServerSettings configServers :: Lens' Configuration (HashMap Text ServerSettings) configPalette :: Lens' Configuration Palette configWindowNames :: Lens' Configuration Text configNickPadding :: Lens' Configuration PaddingMode configMacros :: Lens' Configuration (Recognizer Macro) configExtensions :: Lens' Configuration [FilePath] configExtraHighlights :: Lens' Configuration (HashSet Identifier) configUrlOpener :: Lens' Configuration (Maybe FilePath) configIgnores :: Lens' Configuration [Text] configActivityBar :: Lens' Configuration Bool configBellOnMention :: Lens' Configuration Bool configHideMeta :: Lens' Configuration Bool configKeyMap :: Lens' Configuration KeyMap configLayout :: Lens' Configuration LayoutMode configJumpModifier :: Lens' Configuration [Modifier] -- | Load the configuration file defaulting to -- ~.glircconfig. loadConfiguration :: Maybe FilePath -> IO (Either ConfigurationFailure Configuration) -- | Uses getXdgDirectory XdgConfig to find -- .configglircconfig getNewConfigPath :: IO FilePath configurationSpec :: ValueSpecs (ServerSettings -> Configuration) instance GHC.Show.Show Client.Configuration.ConfigurationFailure instance GHC.Exception.Exception Client.Configuration.ConfigurationFailure instance GHC.Show.Show Client.Configuration.Configuration instance GHC.Show.Show Client.Configuration.LayoutMode instance GHC.Show.Show Client.Configuration.PaddingMode -- | This module provides image renderers for messages. module Client.Image.Message -- | Parameters used when rendering messages data MessageRendererParams MessageRendererParams :: [Char] -> [Char] -> HashSet Identifier -> HashSet Identifier -> Palette -> MessageRendererParams -- | restricted message sigils [rendStatusMsg] :: MessageRendererParams -> [Char] -- | sender sigils [rendUserSigils] :: MessageRendererParams -> [Char] -- | nicknames to highlight [rendNicks] :: MessageRendererParams -> HashSet Identifier -- | nicknames to highlight in red [rendMyNicks] :: MessageRendererParams -> HashSet Identifier -- | nick color palette [rendPalette] :: MessageRendererParams -> Palette -- | Level of detail to use when rendering data RenderMode -- | only render nicknames NormalRender :: RenderMode -- | render full user info DetailedRender :: RenderMode data IdentifierColorMode -- | An identifier in a PRIVMSG PrivmsgIdentifier :: IdentifierColorMode -- | An identifier somewhere else NormalIdentifier :: IdentifierColorMode -- | Default MessageRendererParams 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', Image', Image') -- | Returns image and identifier to be used when collapsing metadata -- messages. metadataImg :: IrcSummary -> Maybe (Image', Identifier, 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 :: Palette -> 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 :: Palette -> RenderMode -> HashSet Identifier -> UserInfo -> Image' -- | Render a nickname in its hash-based color. coloredIdentifier :: Palette -> IdentifierColorMode -> HashSet Identifier -> Identifier -> Image' cleanText :: Text -> Text cleanChar :: Char -> Char -- | Optionally add padding to an input image according to the specified -- mode. If the input image is already wider than the specified padding -- mode, the image is returned unmodified. nickPad :: PaddingMode -> Image' -> Image' -- | Render a ZonedTime as time using quiet attributes -- --
-- 23:15 --timeImage :: Palette -> TimeOfDay -> Image' -- | Render the normal view of a chat message line padded and wrapped. drawWindowLine :: Palette -> Int -> PaddingMode -> WindowLine -> [Image'] -- | Parse message text to construct an image. If the text has formatting -- control characters in it then the text will be rendered according to -- the formatting codes. Otherwise the nicknames in the message are -- highlighted. parseIrcTextWithNicks :: Palette -> HashSet Identifier -> HashSet Identifier -> Bool -> Text -> Image' -- | This module renders the lines used to list the ignore masks. module Client.View.IgnoreList -- | Render the lines used in a channel mask list. ignoreListLines :: HashSet Identifier -> Palette -> [Image'] -- | This module provides provides logging functionality for IRC traffic. module Client.Log -- | Log entry queued in client to be written by the event loop data LogLine LogLine :: FilePath -> Day -> Text -> Text -> LogLine -- | log directory from server settings [logBaseDir] :: LogLine -> FilePath -- | localtime day [logDay] :: LogLine -> Day -- | channel or nickname [logTarget] :: LogLine -> Text -- | formatted log message text [logLine] :: LogLine -> Text -- | Write the given log entry to the filesystem. writeLogLine :: LogLine -> IO () -- | Ignore all IOErrors ignoreProblems :: IO () -> IO () -- | Construct a LogLine for the given ClientMessage when -- appropriate. Only chat messages result in a log line. renderLogLine :: ClientMessage -> FilePath -> Identifier -> Maybe LogLine -- | This module process command-line options provided when launching the -- client. module Client.Options -- | Command-line options data Options Options :: Maybe FilePath -> [Text] -> Bool -> Bool -> Bool -> Bool -> Bool -> Options -- | configuration file path [_optConfigFile] :: Options -> Maybe FilePath -- | initial networks [_optInitialNetworks] :: Options -> [Text] -- | disable autoconnect [_optNoConnect] :: Options -> Bool -- | show help message [_optShowHelp] :: Options -> Bool -- | show version message [_optShowVersion] :: Options -> Bool -- | show version of ALL transitive dependencies [_optShowFullVersion] :: Options -> Bool -- | show configuration file format [_optShowConfigFormat] :: Options -> Bool optConfigFile :: Lens' Options (Maybe FilePath) optInitialNetworks :: Lens' Options [Text] optNoConnect :: Lens' Options Bool -- | Load command line options. This action will terminate early in the -- case of the version flag, help flag, or an error. getOptions :: IO Options -- | Lines for the /rtsstats command. This module depends on GHC -- 8.2.1 API. module Client.View.RtsStats -- | Generate lines used for /rtsstats. rtsStatsLines :: Maybe Stats -> Palette -> [Image'] -- | 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.State.Network -- | State tracked for each IRC connection data NetworkState NetworkState :: !NetworkId -> !(HashMap Identifier ChannelState) -> !NetworkConnection -> !ModeTypes -> ![Char] -> !Transaction -> ![Char] -> ![Char] -> !ServerSettings -> !UserInfo -> !(HashMap Identifier UserAndHost) -> !Int -> !Text -> !(Maybe UTCTime) -> !PingStatus -> !(Maybe UTCTime) -> ![Text] -> !AuthenticateState -> NetworkState -- | network connection identifier [_csNetworkId] :: NetworkState -> !NetworkId -- | joined channels [_csChannels] :: NetworkState -> !(HashMap Identifier ChannelState) -- | network socket [_csSocket] :: NetworkState -> !NetworkConnection -- | channel mode meanings [_csModeTypes] :: NetworkState -> !ModeTypes -- | channel identifier prefixes [_csChannelTypes] :: NetworkState -> ![Char] -- | state for multi-message sequences [_csTransaction] :: NetworkState -> !Transaction -- | modes for the connected user [_csModes] :: NetworkState -> ![Char] -- | modes that prefix statusmsg channel names [_csStatusMsg] :: NetworkState -> ![Char] -- | settings used for this connection [_csSettings] :: NetworkState -> !ServerSettings -- | usermask used by the server for this connection [_csUserInfo] :: NetworkState -> !UserInfo -- | user and hostname for other nicks [_csUsers] :: NetworkState -> !(HashMap Identifier UserAndHost) -- | maximum mode changes per MODE command [_csModeCount] :: NetworkState -> !Int -- | name of network connection [_csNetwork] :: NetworkState -> !Text -- | time for next ping event [_csNextPingTime] :: NetworkState -> !(Maybe UTCTime) -- | state of ping timer [_csPingStatus] :: NetworkState -> !PingStatus -- | time of last message received [_csLastReceived] :: NetworkState -> !(Maybe UTCTime) -- | names of message hooks to apply to this connection [_csMessageHooks] :: NetworkState -> ![Text] [_csAuthenticationState] :: NetworkState -> !AuthenticateState -- | State of the authentication transaction data AuthenticateState -- | no active transaction AS_None :: AuthenticateState -- | PLAIN mode initiated AS_PlainStarted :: AuthenticateState -- | ECDSA-NIST mode initiated AS_EcdsaStarted :: AuthenticateState -- | ECDSA_NIST user sent waiting for challenge AS_EcdsaWaitChallenge :: AuthenticateState -- | Construct a new network state using the given settings and default -- values as specified by the IRC specification. newNetworkState :: NetworkId -> Text -> ServerSettings -> NetworkConnection -> PingStatus -> NetworkState csNick :: Lens' NetworkState Identifier csChannels :: Lens' NetworkState (HashMap Identifier ChannelState) csSocket :: Lens' NetworkState NetworkConnection csModeTypes :: Lens' NetworkState ModeTypes csChannelTypes :: Lens' NetworkState [Char] csTransaction :: Lens' NetworkState Transaction csModes :: Lens' NetworkState [Char] csStatusMsg :: Lens' NetworkState [Char] csSettings :: Lens' NetworkState ServerSettings csUserInfo :: Lens' NetworkState UserInfo csUsers :: Lens' NetworkState (HashMap Identifier UserAndHost) csUser :: Functor f => Identifier -> LensLike' f NetworkState (Maybe UserAndHost) csModeCount :: Lens' NetworkState Int csNetworkId :: Lens' NetworkState NetworkId csNetwork :: Lens' NetworkState Text csNextPingTime :: Lens' NetworkState (Maybe UTCTime) csPingStatus :: Lens' NetworkState PingStatus csLastReceived :: Lens' NetworkState (Maybe UTCTime) csMessageHooks :: Lens' NetworkState [Text] csAuthenticationState :: Lens' NetworkState AuthenticateState -- | Pair of username and hostname. Empty strings represent missing -- information. data UserAndHost -- | username hostname UserAndHost :: {-# UNPACK #-} !Text -> {-# UNPACK #-} !Text -> UserAndHost data Transaction NoTransaction :: Transaction NamesTransaction :: [Text] -> Transaction BanTransaction :: [(Text, MaskListEntry)] -> Transaction WhoTransaction :: [UserInfo] -> Transaction isChannelIdentifier :: NetworkState -> Identifier -> Bool -- | Predicate to test if the connection has op in a given channel. iHaveOp :: Identifier -> NetworkState -> Bool -- | Transmit a RawIrcMsg on the connection associated with the -- given network. For PRIVMSG and NOTICE overlong -- commands are detected and transmitted as multiple messages. sendMsg :: NetworkState -> RawIrcMsg -> IO () initialMessages :: NetworkState -> [RawIrcMsg] applyMessage :: ZonedTime -> IrcMsg -> NetworkState -> ([RawIrcMsg], NetworkState) -- | 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 -- | Status of the ping timer data PingStatus -- | ping sent waiting for pong PingSent :: !UTCTime -> PingStatus -- | latency in seconds for last ping PingLatency :: !Double -> PingStatus -- | no ping sent PingNever :: PingStatus -- | number of attempts, last known connection time PingConnecting :: !Int -> !(Maybe UTCTime) -> PingStatus _PingConnecting :: Prism' PingStatus (Int, Maybe UTCTime) -- | Timer-based events data TimedAction -- | terminate the connection due to timeout TimedDisconnect :: TimedAction -- | transmit a ping to the server TimedSendPing :: TimedAction -- | Compute the earliest timed action for a connection, if any nextTimedAction :: NetworkState -> Maybe (UTCTime, TimedAction) -- | Apply the given TimedAction to a connection state. applyTimedAction :: TimedAction -> NetworkState -> IO NetworkState useChanServ :: Identifier -> NetworkState -> Bool -- | Used to send commands that require ops to perform. If this channel is -- one that the user has chanserv access and ops are needed then ops are -- requested and the commands are queued, otherwise send them directly. sendModeration :: Identifier -> [RawIrcMsg] -> NetworkState -> IO NetworkState sendTopic :: Identifier -> Text -> NetworkState -> IO () instance GHC.Show.Show Client.State.Network.TimedAction instance GHC.Classes.Ord Client.State.Network.TimedAction instance GHC.Classes.Eq Client.State.Network.TimedAction instance GHC.Show.Show Client.State.Network.NetworkState instance GHC.Show.Show Client.State.Network.Transaction instance GHC.Show.Show Client.State.Network.PingStatus instance GHC.Show.Show Client.State.Network.UserAndHost instance GHC.Show.Show Client.State.Network.AuthenticateState -- | This module provides the core logic of the IRC client. The client -- state tracks everything about the client. module Client.State -- | All state information for the IRC client data ClientState ClientState :: !(Map Focus Window) -> !Focus -> !Focus -> !Focus -> !Subfocus -> ![Focus] -> !(IntMap NetworkState) -> !(TQueue NetworkEvent) -> !(HashMap Text NetworkId) -> !Configuration -> !(Maybe FilePath) -> !EditBox -> !Int -> !Int -> !Int -> !Int -> !Bool -> !Bool -> Maybe Regex -> !LayoutMode -> !Bool -> !(HashSet Identifier) -> Mask -> !ExtensionState -> ![LogLine] -> Maybe Text -> Maybe Stats -> ClientState -- | client message buffers [_clientWindows] :: ClientState -> !(Map Focus Window) -- | previously focused buffer [_clientPrevFocus] :: ClientState -> !Focus -- | focus prior to jumping to activity [_clientActivityReturn] :: ClientState -> !Focus -- | currently focused buffer [_clientFocus] :: ClientState -> !Focus -- | current view mode [_clientSubfocus] :: ClientState -> !Subfocus -- | extra messages windows to view [_clientExtraFocus] :: ClientState -> ![Focus] -- | state of active connections [_clientConnections] :: ClientState -> !(IntMap NetworkState) -- | incoming network event queue [_clientEvents] :: ClientState -> !(TQueue NetworkEvent) -- | network name to connection ID [_clientNetworkMap] :: ClientState -> !(HashMap Text NetworkId) -- | client configuration [_clientConfig] :: ClientState -> !Configuration -- | client configuration file path [_clientConfigPath] :: ClientState -> !(Maybe FilePath) -- | primary text box [_clientTextBox] :: ClientState -> !EditBox -- | size to crop from left of text box [_clientTextBoxOffset] :: ClientState -> !Int -- | current terminal width [_clientWidth] :: ClientState -> !Int -- | current terminal height [_clientHeight] :: ClientState -> !Int -- | buffer scroll lines [_clientScroll] :: ClientState -> !Int -- | use detailed rendering mode [_clientDetailView] :: ClientState -> !Bool -- | visible activity bar [_clientActivityBar] :: ClientState -> !Bool -- | optional persistent filter [_clientRegex] :: ClientState -> Maybe Regex -- | layout mode for split screen [_clientLayout] :: ClientState -> !LayoutMode -- | sound a bell next draw [_clientBell] :: ClientState -> !Bool -- | ignored masks [_clientIgnores] :: ClientState -> !(HashSet Identifier) -- | precomputed ignore regular expression (lazy) [_clientIgnoreMask] :: ClientState -> Mask -- | state of loaded extensions [_clientExtensions] :: ClientState -> !ExtensionState -- | log lines ready to write [_clientLogQueue] :: ClientState -> ![LogLine] -- | transient error box text [_clientErrorMsg] :: ClientState -> Maybe Text -- | most recent GHC RTS stats [_clientRtsStats] :: ClientState -> Maybe Stats clientWindows :: Lens' ClientState (Map Focus Window) clientTextBox :: Lens' ClientState EditBox clientTextBoxOffset :: Lens' ClientState Int clientConnections :: Lens' ClientState (IntMap NetworkState) clientWidth :: Lens' ClientState Int clientHeight :: Lens' ClientState Int clientEvents :: Lens' ClientState (TQueue NetworkEvent) clientFocus :: Lens' ClientState Focus clientPrevFocus :: Lens' ClientState Focus clientExtraFocus :: Lens' ClientState [Focus] clientConfig :: Lens' ClientState Configuration clientScroll :: Lens' ClientState Int clientDetailView :: Lens' ClientState Bool clientActivityBar :: Lens' ClientState Bool clientSubfocus :: Lens' ClientState Subfocus clientNetworkMap :: Lens' ClientState (HashMap Text NetworkId) clientIgnores :: Lens' ClientState (HashSet Identifier) clientIgnoreMask :: Lens' ClientState Mask -- | Traversal for finding the NetworkState associated with a -- given network if that connection is currently active. clientConnection :: Applicative f => Text -> LensLike' f ClientState NetworkState clientBell :: Lens' ClientState Bool clientExtensions :: Lens' ClientState ExtensionState clientRegex :: Lens' ClientState (Maybe Regex) clientLogQueue :: Lens' ClientState [LogLine] clientActivityReturn :: Lens' ClientState Focus clientErrorMsg :: Lens' ClientState (Maybe Text) clientLayout :: Lens' ClientState LayoutMode clientRtsStats :: Lens' ClientState (Maybe Stats) clientConfigPath :: Lens' ClientState (Maybe FilePath) -- | Construct an initial ClientState using default values. withClientState :: Maybe FilePath -> Configuration -> (ClientState -> IO a) -> IO a -- | Start extensions after ensuring existing ones are stopped clientStartExtensions :: ClientState -> IO ClientState -- | Actions to be run when exiting the client. clientShutdown :: ClientState -> IO () -- | Prepare the client to support reentry from the extension API. clientPark :: ClientState -> (Ptr () -> IO a) -> IO (ClientState, a) -- | Returns the current filtering predicate if one is active. clientMatcher :: ClientState -> Maybe (Text -> Bool) -- | Strict version of clientMatcher clientMatcher' :: ClientState -> Maybe (Text -> Bool) -- | Construct a text matching predicate used to filter the message window. clientActiveRegex :: ClientState -> Maybe Regex -- | Toggle the hide metadata setting for the focused window. clientToggleHideMeta :: ClientState -> ClientState -- | Compute the set of extra identifiers that should be highlighted given -- a particular network. clientHighlightsNetwork :: Text -> ClientState -> HashSet Identifier channelUserList :: Text -> Identifier -> ClientState -> [Identifier] -- | Add the textbox input to the edit history and clear the textbox. consumeInput :: ClientState -> ClientState -- | Returns the current network's channels and current channel's users. currentCompletionList :: ClientState -> [Identifier] -- | Predicate for nicknames to determine if messages should be ignored. identIgnored :: UserInfo -> ClientState -> Bool -- | The full top-most line that would be executed clientFirstLine :: ClientState -> String -- | The line under the cursor in the edit box. clientLine :: ClientState -> (Int, String) -- | Forcefully terminate the connection currently associated with a given -- network name. abortNetwork :: Text -> ClientState -> IO ClientState -- | Start a new connection. The delay is used for reconnections. addConnection :: Int -> Maybe UTCTime -> Text -> ClientState -> IO ClientState -- | Remove a network connection and unlink it from the network map. This -- operation assumes that the network connection exists and should only -- be applied once per connection. removeNetwork :: NetworkId -> ClientState -> (NetworkState, ClientState) -- | Function applied to the client state every redraw. clientTick :: ClientState -> ClientState applyMessageToClientState :: ZonedTime -> IrcMsg -> NetworkId -> NetworkState -> ClientState -> ([RawIrcMsg], ClientState) -- | Compute the set of extra identifiers that should be highlighted given -- a particular network state. clientHighlights :: NetworkState -> ClientState -> HashSet Identifier -- | Produce the list of window names configured for the client. clientWindowNames :: ClientState -> [Char] -- | Produce the list of window names configured for the client. clientPalette :: ClientState -> Palette -- | Returns the list of network names that requested autoconnection. clientAutoconnects :: ClientState -> [Text] -- | Compute the command and arguments currently in the textbox. clientActiveCommand :: ClientState -> Maybe (String, String) -- | List of extra focuses to display as split windows clientExtraFocuses :: ClientState -> [Focus] -- | Returns the WordCompletionMode associated with the current -- network. currentNickCompletionMode :: ClientState -> WordCompletionMode -- | Add a message to the window associated with a given channel recordChannelMessage :: Text -> Identifier -> ClientMessage -> ClientState -> ClientState -- | Record a message on a network window recordNetworkMessage :: ClientMessage -> ClientState -> ClientState -- | Record a message in the windows corresponding to the given target recordIrcMessage :: Text -> MessageTarget -> ClientMessage -> ClientState -> ClientState -- | Change the window focus to the given value, reset the subfocus to -- message view, reset the scroll, remember the previous focus if it -- changed. changeFocus :: Focus -> ClientState -> ClientState -- | Change the subfocus to the given value, preserve the focus, reset the -- scroll. changeSubfocus :: Subfocus -> ClientState -> ClientState -- | Return to previously focused window. returnFocus :: ClientState -> ClientState -- | Step focus to the next window when on message view. Otherwise switch -- to message view. advanceFocus :: ClientState -> ClientState -- | Step focus to the next window when on message view. Otherwise switch -- to message view. advanceNetworkFocus :: ClientState -> ClientState -- | Step focus to the previous window when on message view. Otherwise -- switch to message view. retreatFocus :: ClientState -> ClientState -- | Jump the focus of the client to a buffer that has unread activity. -- Some events like errors or chat messages mentioning keywords are -- considered important and will be jumped to first. jumpToActivity :: ClientState -> ClientState -- | Jump the focus directly to a window based on its zero-based index. jumpFocus :: Int -> ClientState -> ClientState -- | Unified logic for assigning to the extra focuses field that activates -- and deactivates windows as needed. setExtraFocus :: [Focus] -> ClientState -> ClientState -- | Scroll the current buffer to show newer messages scrollClient :: Int -> ClientState -> ClientState -- | State of the extension API including loaded extensions and the -- mechanism used to support reentry into the Haskell runtime from the C -- API. data ExtensionState esActive :: Lens' ExtensionState [ActiveExtension] -- | Regular expression for matching HTTP/HTTPS URLs in chat text. urlPattern :: Regex -- | Find all the URL matches using urlPattern in a given -- Text suitable for being opened. Surrounding < and -- > are removed. urlMatches :: Text -> [Text] -- | This module implements the rendering of the client window list. module Client.View.Windows -- | Draw the image lines associated with the /windows command. windowsImages :: WindowsFilter -> ClientState -> [Image'] -- | This module renders the lines used in the channel user list. module Client.View.UserList -- | Render the lines used by the /users command in normal mode. -- These lines show the count of users having each channel mode in -- addition to the nicknames of the users. userListImages :: Text -> Identifier -> ClientState -> [Image'] -- | Render lines for the /users command in detailed view. Each -- user will be rendered on a separate line with username and host -- visible when known. userInfoImages :: Text -> Identifier -> ClientState -> [Image'] -- | This module provides a list of the URLs found in the current message -- window in order to assist in selecting one to open with /url module Client.View.UrlSelection -- | Generate the lines used for the view when typing /url urlSelectionView :: Int -> Focus -> String -> ClientState -> [Image'] -- | This module returns the chat messages for the currently focused window -- in message view and gathers metadata entries into single lines. module Client.View.Messages chatMessageImages :: Focus -> Int -> ClientState -> [Image'] -- | This module renders the lines used in the channel mask list. A mask -- list can show channel bans, quiets, invites, and exceptions. module Client.View.MaskList -- | Render the lines used in a channel mask list maskListImages :: Char -> Text -> Identifier -> Int -> ClientState -> [Image'] -- | This module provides a view of the key bindings map module Client.View.KeyMap -- | Render the lines of a table showing all of the available digraph -- entries keyMapLines :: ClientState -> [Image'] -- | This module provides a view of the built-in digraph list. module Client.View.Digraphs -- | Render the lines of a table showing all of the available digraph -- entries digraphLines :: Int -> ClientState -> [Image'] -- | This module implements a renderer for the window that shows channel -- metadata. module Client.View.ChannelInfo -- | Render the lines used in a channel mask list channelInfoImages :: Text -> Identifier -> ClientState -> [Image'] -- | This module provides image renderers used to construct the status -- image that sits between text input and the message window. module Client.Image.StatusLine -- | Renders the status line between messages and the textbox. statusLineImage :: Int -> ClientState -> Image -- | The minor status line is used when rendering the /splits and -- /mentions views to show the associated window name. minorStatusLineImage :: Focus -> Int -> Bool -> ClientState -> Image' -- | This module provides the lines that have been highlighted across the -- client in sorted order. module Client.View.Mentions -- | Generate the list of message lines marked important ordered by time. -- Each run of lines from the same channel will be grouped together. -- Messages are headed by their window, network, and channel. mentionsViewLines :: Int -> ClientState -> [Image'] -- | 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 the client, consume input if command was from input CommandSuccess :: ClientState -> CommandResult -- | Continue running the client, report an error CommandFailure :: ClientState -> CommandResult -- | Client should close CommandQuit :: ClientState -> CommandResult -- | Interpret the given chat message or command. Leading / -- indicates a command. Otherwise if a channel or user query is focused a -- chat message will be sent. execute :: String -> ClientState -> IO CommandResult -- | Execute command provided by user, resolve aliases if necessary. executeUserCommand :: Maybe Text -> String -> ClientState -> IO CommandResult -- | Compute the replacement value for the given expansion variable. commandExpansion :: Maybe Text -> ClientState -> Text -> Maybe Text -- | Respond to the TAB key being pressed. This can dispatch to a command -- specific completion mode when relevant. Otherwise this will complete -- input based on the users of the channel related to the current buffer. tabCompletion :: Bool -> ClientState -> IO CommandResult -- | A command section is a logical grouping of commands. This allows for -- showing more structure in the help menu system. data CommandSection CommandSection :: Text -> [Command] -> CommandSection [cmdSectionName] :: CommandSection -> Text [cmdSectionCmds] :: CommandSection -> [Command] -- | A command is a list of aliases, an argument specification, -- implementation, and documentation. The arguments and implementation -- must match so that the parsed arguments will match what the -- implementation expects. data Command Command :: NonEmpty Text -> Args ClientState a -> Text -> CommandImpl a -> Command -- | Names of this command, first in the list is the "primary" name [cmdNames] :: Command -> NonEmpty Text -- | Specification of the arguments of the command [cmdArgumentSpec] :: Command -> Args ClientState a -- | Multi-line IRC-formatted documentation text used for /help [cmdDocumentation] :: Command -> Text -- | Implementation of the command for both execution and tab completion [cmdImplementation] :: Command -> CommandImpl a -- | Pair of implementations for executing a command and tab completing -- one. The tab-completion logic is extended with a bool indicating that -- tab completion should be reversed data CommandImpl a -- | no requirements ClientCommand :: (ClientCommand a) -> (Bool -> ClientCommand String) -> CommandImpl a -- | requires an active network NetworkCommand :: (NetworkCommand a) -> (Bool -> NetworkCommand String) -> CommandImpl a -- | requires an active chat window ChatCommand :: (ChannelCommand a) -> (Bool -> ChannelCommand String) -> CommandImpl a -- | requires an active channel window ChannelCommand :: (ChannelCommand a) -> (Bool -> ChannelCommand String) -> CommandImpl a -- | Map of built-in client commands to their implementations, tab -- completion logic, and argument structures. commands :: Recognizer Command -- | Raw list of commands in the order used for /help commandsList :: [CommandSection] -- | This module provides the rendering used for the /help -- command. module Client.View.Help -- | Generate either the list of all commands and their arguments, or when -- given a command name generate the detailed help text for that command. helpImageLines :: ClientState -> Maybe Text -> Palette -> [Image'] -- | This module selects the correct view based on the current state. module Client.View viewLines :: Focus -> Subfocus -> Int -> ClientState -> [Image'] -- | This module provides the renderer for the client's text box input. module Client.Image.Textbox -- | Compute the UI image for the text input box. This computes the logical -- cursor position on the screen to compensate for VTY's cursor placement -- behavior. textboxImage :: Int -> ClientState -> (Int, Int, Image) module Client.Image.Layout -- | Compute the number of lines in a page at the current window size scrollAmount :: ClientState -> Int -- | Compute the combined image for all the visible message windows. drawLayout :: ClientState -> (Int, Int, Int, 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 :: Vty -> ClientState -> IO () -- | Update the height and width fields of the client state updateTerminalSize :: Vty -> ClientState -> IO ClientState -- | This module exports the C functions that extensions can used to query -- the state of the client. module Client.CApi.Exports -- | Network, command, and parameters are used when transmitting a message. type Glirc_send_message = Ptr () api token -> Ptr FgnMsg pointer to message -> IO CInt 0 on success glirc_send_message :: Glirc_send_message -- | Print a message or error to the client window type Glirc_print = Ptr () api token -> MessageCode enum message_code -> CString message -> CSize message length -> IO CInt 0 on success glirc_print :: Glirc_print -- | The resulting strings and array of strings are malloc'd and the caller -- must free them. NULL returned on failure. type Glirc_list_networks = Ptr () api token -> IO (Ptr CString) null terminated array of null terminated strings glirc_list_networks :: Glirc_list_networks -- | The resulting strings and array of strings are malloc'd and the caller -- must free them. NULL returned on failure. type Glirc_list_channels = Ptr () api token -> CString network -> CSize network len -> IO (Ptr CString) null terminated array of null terminated strings glirc_list_channels :: Glirc_list_channels -- | The resulting strings and array of strings are malloc'd and the caller -- must free them. NULL returned on failure. type Glirc_list_channel_users = Ptr () api token -> CString network -> CSize network len -> CString channel -> CSize channel len -> IO (Ptr CString) null terminated array of null terminated strings glirc_list_channel_users :: Glirc_list_channel_users -- | The resulting string is malloc'd and the caller must free it. NULL -- returned on failure. type Glirc_my_nick = Ptr () api token -> CString network name -> CSize network name length -> IO CString glirc_my_nick :: Glirc_my_nick -- | Case insensitive comparison suitable for use on channels and -- nicknames. Returns -1 if the first identifier is less than the second -- Returns 0 if the first identifier is equal to the second Returns 1 if -- the first identifier is greater than the second type Glirc_identifier_cmp = CString identifier 1 -> CSize identifier 1 len -> CString identifier 2 -> CSize identifier 2 len -> IO CInt glirc_identifier_cmp :: Glirc_identifier_cmp -- | Returns 1 when the given target on the given network is a -- channel name, otherwise returns 0. -- -- If the given network is not currently active this returns 0. type Glirc_is_channel = Ptr () api token -> CString network name -> CSize network length -> CString target name -> CSize target length -> IO CInt boolean glirc_is_channel :: Glirc_is_channel -- | Returns 1 when the given target on the given network shares a -- channel with the user, 0 otherwise. -- -- If the given network is not currently active this returns 0. type Glirc_is_logged_on = Ptr () api token -> CString network name -> CSize network length -> CString target name -> CSize target length -> IO CInt boolean glirc_is_logged_on :: Glirc_is_channel -- | Mark a window as being seen clearing the new message counter. To clear -- the client window send an empty network name. To clear a network -- window send an empty channel name. type Glirc_mark_seen = Ptr () api token -> CString network name -> CSize network name length -> CString channel name -> CSize channel name length -> IO () glirc_mark_seen :: Glirc_mark_seen -- | Mark a window as being seen clearing the new message counter. To clear -- the client window send an empty network name. To clear a network -- window send an empty channel name. type Glirc_clear_window = Ptr () api token -> CString network name -> CSize network name length -> CString channel name -> CSize channel name length -> IO () glirc_clear_window :: Glirc_clear_window -- | Free an array of heap allocated strings found as a return value from -- the extension API. If argument is NULL, nothing happens. -- -- Free the allocated strings with glirc_free_string -- -- Strings set to NULL if there is no current network or no current -- target. type Glirc_current_focus = Ptr () api token -> Ptr CString newly allocated network string -> Ptr CSize network length -> Ptr CString newly allocated target string -> Ptr CSize target length -> IO () glirc_current_focus :: Glirc_current_focus -- | Free one of the heap allocated strings found as a return value from -- the extension API. If argument is NULL, nothing happens. type Glirc_free_string = CString glirc allocated string -> IO () glirc_free_string :: Glirc_free_string -- | Free an array of heap allocated strings found as a return value from -- the extension API. If argument is NULL, nothing happens. type Glirc_free_strings = Ptr CString glirc allocated strings, null-terminated -> IO () glirc_free_strings :: Glirc_free_strings -- | Print a message or error to the client window type Glirc_inject_chat = Ptr () api token -> CString network -> CSize network length -> CString source -> CSize source length -> CString target -> CSize target length -> CString message -> CSize message length -> IO CInt 0 on success glirc_inject_chat :: Glirc_inject_chat