Documentation ¶
Index ¶
- Constants
- type Controller
- type Field
- func (f *Field) Editable(msgID cchat.ID) bool
- func (f *Field) Reset()
- func (f *Field) SetAllowUpload(allow bool)
- func (f *Field) SetMessenger(session cchat.Session, messenger cchat.Messenger)
- func (f *Field) StartEditing(msgID cchat.ID) bool
- func (f *Field) StartReplyingTo(msgID cchat.ID)
- func (f *Field) StopEditing() bool
- type Files
- type InputView
- type LabelBorrower
- type SendMessageData
- func (s SendMessageData) AsAttacher() cchat.Attacher
- func (s SendMessageData) AsNoncer() cchat.Noncer
- func (s SendMessageData) AsReplier() cchat.Replier
- func (s SendMessageData) Content() string
- func (s SendMessageData) Files() []attachment.File
- func (s SendMessageData) ID() string
- func (s SendMessageData) Nonce() string
- func (s SendMessageData) ReplyingTo() cchat.ID
- func (s SendMessageData) Time() time.Time
Constants ¶
const ( ClampMaxSize = 1000 ClampThreshold = ClampMaxSize )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { LatestMessageFrom(userID cchat.ID) container.MessageRow MessageAuthor(msgID cchat.ID) *message.Author Author(authorID cchat.ID) (name rich.LabelStateStorer) // SendMessage asynchronously sends the given message. SendMessage(msg message.PresendMessage) }
Controller is an interface to control message containers.
type Field ¶
type Field struct { *gtk.Box Clamp *handy.Clamp // MainBox contains the field box and the attachment container. MainBox *gtk.Box Attachments *attachment.Container // FieldMainBox contains the username container and the input field. It spans // horizontally. FieldBox *gtk.Box Username *username.Container TextScroll *gtk.ScrolledWindow // contains filtered or unexported fields }
func NewField ¶
func NewField(text *gtk.TextView, ctrl Controller, labeler LabelBorrower) *Field
func (*Field) Reset ¶
func (f *Field) Reset()
Reset prepares the field before SetSender() is called.
func (*Field) SetAllowUpload ¶
func (*Field) SetMessenger ¶
SetMessenger changes the messenger of the input field. If nil, the input will be disabled. Reset() should be called first.
func (*Field) StartReplyingTo ¶
func (*Field) StopEditing ¶
StopEditing cancels the current editing message. It returns a false and does nothing if the editor is not editing anything.
type Files ¶
type Files []attachment.File
Files is a list of attachments.
func (Files) Attachments ¶
func (files Files) Attachments() []cchat.MessageAttachment
Attachments returns the list of files as a list of cchat attachments.
type InputView ¶
type InputView struct { *Field Completer *completion.Completer }
func NewView ¶
func NewView(ctrl Controller, labeler LabelBorrower) *InputView
type LabelBorrower ¶
type LabelBorrower interface { BorrowLabel(markup string) Unborrow() }
LabelBorrower is an interface that allows the caller to borrow a label.
type SendMessageData ¶
type SendMessageData struct {
// contains filtered or unexported fields
}
SendMessageData contains what is to be sent in a message. It behaves similarly to a regular CreateMessage.
func (SendMessageData) AsAttacher ¶
func (s SendMessageData) AsAttacher() cchat.Attacher
func (SendMessageData) AsNoncer ¶
func (s SendMessageData) AsNoncer() cchat.Noncer
func (SendMessageData) AsReplier ¶
func (s SendMessageData) AsReplier() cchat.Replier
func (SendMessageData) Content ¶
func (s SendMessageData) Content() string
func (SendMessageData) Files ¶
func (s SendMessageData) Files() []attachment.File
func (SendMessageData) ID ¶
func (s SendMessageData) ID() string
ID returns a pseudo ID for internal use.
func (SendMessageData) Nonce ¶
func (s SendMessageData) Nonce() string
func (SendMessageData) ReplyingTo ¶
func (s SendMessageData) ReplyingTo() cchat.ID
func (SendMessageData) Time ¶
func (s SendMessageData) Time() time.Time