matterhorn-50200.12.0: Terminal client for the Mattermost chat system
Safe HaskellNone
LanguageHaskell2010

Matterhorn.Draw.Messages

Synopsis

Documentation

data MessageData Source #

A bundled structure that includes all the information necessary to render a given message

Constructors

MessageData 

Fields

  • mdEditThreshold :: Maybe ServerTime

    If specified, any messages edited before this point in time are not indicated as edited.

  • mdShowOlderEdits :: Bool

    Indicates whether "edited" markers should be shown for old messages (i.e., ignore the mdEditThreshold value).

  • mdShowReactions :: Bool

    Whether to render reactions.

  • mdMessage :: Message

    The message to render.

  • mdUserName :: Maybe Text

    The username of the message's author, if any. This is passed here rather than obtaining from the message because we need to do lookups in the ChatState to compute this, and we don't pass the ChatState into renderMessage.

  • mdParentMessage :: Maybe Message

    The parent message of this message, if any.

  • mdParentUserName :: Maybe Text

    The author of the parent message, if any.

  • mdThreadState :: ThreadState

    The thread state of this message.

  • mdRenderReplyParent :: Bool

    Whether to render the parent message.

  • mdHighlightSet :: HighlightSet

    The highlight set to use to highlight usernames, channel names, etc.

  • mdIndentBlocks :: Bool

    Whether to indent the message underneath the author's name (True) or just display it to the right of the author's name (False).

  • mdMessageWidthLimit :: Maybe Int

    A width override to use to wrap non-code blocks and code blocks without syntax highlighting. If unspecified, all blocks in the message will be wrapped and truncated at the width specified by the rendering context. If specified, all non-code blocks will be wrapped at this width and highlighted code blocks will be rendered using the context's width.

  • mdMyUsername :: Text

    The username of the user running Matterhorn.

  • mdWrapNonhighlightedCodeBlocks :: Bool

    Whether to wrap text in non-highlighted code blocks.

renderMessage :: MessageData -> Widget Name Source #

renderMessage performs markdown rendering of the specified message.

nameForUserRef :: ChatState -> UserRef -> Maybe Text Source #

nameForUserRef converts the UserRef into a printable name, based on the current known user data.

renderSingleMessage :: ChatState -> HighlightSet -> Maybe ServerTime -> Message -> ThreadState -> Widget Name Source #

renderSingleMessage is the main message drawing function.

The ind argument specifies an "indicator boundary". Showing various indicators (e.g. "edited") is not typically done for messages that are older than this boundary value.

unsafeRenderMessageSelection :: (Foldable f, Foldable g) => ((Message, ThreadState), (f (Message, ThreadState), g (Message, ThreadState))) -> (Message -> ThreadState -> Widget Name) -> Widget Name Source #

Render a selected message with focus, including the messages before and the messages after it. The foldable parameters exist because (depending on the situation) we might use either of the message list types for the before and after (i.e. the chronological or retrograde message sequences).