Documentation
¶
Index ¶
Constants ¶
const AvatarSize = 40
Variables ¶
var EmptyContentPlaceholder = fmt.Sprintf( `<span alpha="25%%">%s</span>`, html.EscapeString("<empty>"), )
Functions ¶
func NewTimestamp ¶
func NewUsername ¶
Types ¶
type Author ¶
type Author struct { ID cchat.ID Name rich.NameContainer }
Author implements cchat.Author. It effectively contains a copy of cchat.Author.
func NewCustomAuthor ¶
NewCustomAuthor creates a new Author from the given parameters.
type Container ¶
type Container interface { // Unwrap returns the internal message state. Unwrap() *State // Revert unwraps and reverts all widget changes to the internal state then // returns that state. Revert() *State // UpdateContent updates the underlying content widget. UpdateContent(content text.Rich, edited bool) // SetReferenceHighlighter sets the reference highlighter into the message. SetReferenceHighlighter(refer labeluri.ReferenceHighlighter) }
Container describes a message container that wraps a state. These methods are made for containers to override; methods not meant to be override are not exposed and will be done directly on the State.
type PresendMessage ¶
type PresendMessage interface { cchat.MessageHeader cchat.SendableMessage cchat.Noncer Files() []attachment.File }
PresendMessage is an interface for any message about to be sent.
type PresendState ¶
type PresendState struct { *State // contains filtered or unexported fields }
PresendState is the generic state with extra methods implemented for stateful mutability of the generic message state.
func NewPresendState ¶
func NewPresendState(self *Author, msg PresendMessage) *PresendState
NewPresendState creates a new presend state. The caller must call one of the state setters, usually SetLoading.
func (*PresendState) SendingMessage ¶
func (m *PresendState) SendingMessage() PresendMessage
func (*PresendState) SetDone ¶
func (m *PresendState) SetDone(id cchat.ID)
SetDone sets the status of the state.
func (*PresendState) SetLoading ¶
func (m *PresendState) SetLoading()
SetLoading greys the message to indicate that it's loading.
func (*PresendState) SetSensitive ¶
func (m *PresendState) SetSensitive(sensitive bool)
SetSensitive sets the sensitivity of the content.
func (*PresendState) SetSentError ¶
func (m *PresendState) SetSentError(err error)
SetSentError sets the error into the message to notify the user.
type Presender ¶
type Presender interface { SendingMessage() PresendMessage SetDone(id cchat.ID) SetLoading() SetSentError(err error) }
Presender describes actions doable on a presend message container.
type State ¶
type State struct { gtk.Box Row *gtk.ListBoxRow // contains Box ID cchat.ID Time time.Time Nonce string Author *Author Content *gtk.Box ContentBody *labeluri.Label ContentBodyStyle *gtk.StyleContext MenuItems []menu.Item // contains filtered or unexported fields }
State provides a single generic message container for subpackages to use.
func NewEmptyState ¶
func NewEmptyState() *State
NewEmptyState creates a new empty message state. The author should be set immediately afterwards; it is invalid once the state is used.
func NewState ¶
func NewState(msg cchat.MessageCreate) *State
NewState creates a new message state with the given MessageCreate.
func (*State) SetReferenceHighlighter ¶
func (m *State) SetReferenceHighlighter(r labeluri.ReferenceHighlighter)
SetReferenceHighlighter sets the reference highlighter into the message.