chat

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_INPUT_LENGTH = 1024
)

Variables

View Source
var Cmd = &cmd.Command{
	Name:    "chat",
	Help:    "Interactive chat with recipient",
	Context: &ChatContext{},
	Init:    Init,
	Logic:   Logic,
}

Functions

func Init

func Init(c *cmd.Command)

func Logic

func Logic(c *cmd.Command)

func SetFocus

func SetFocus(name string) func(g *gocui.Gui) error

Types

type ChatContext

type ChatContext struct {
	To *string
}

type ChatManager

type ChatManager struct {
	// contains filtered or unexported fields
}

func NewChatManager

func NewChatManager(chatView *ChatView, inputView *InputView, recipient string) (*ChatManager, error)

func (*ChatManager) Connect

func (chatManager *ChatManager) Connect() error

func (*ChatManager) Disconnect

func (chatManager *ChatManager) Disconnect() error

func (*ChatManager) Recipient

func (chatManager *ChatManager) Recipient() string

func (*ChatManager) ScrollDown

func (chatManager *ChatManager) ScrollDown()

func (*ChatManager) ScrollUp

func (chatManager *ChatManager) ScrollUp()

func (*ChatManager) SendMessage

func (chatManager *ChatManager) SendMessage(text string) error

func (*ChatManager) Start

func (chatManager *ChatManager) Start() error

type ChatView

type ChatView struct {
	// contains filtered or unexported fields
}

func NewChatView

func NewChatView(name string, dim ViewDimensionHandler) *ChatView

func (*ChatView) AddMessage

func (cv *ChatView) AddMessage(msg string)

func (*ChatView) Layout

func (cv *ChatView) Layout(g *gocui.Gui) error

func (*ChatView) ScrollDown

func (cv *ChatView) ScrollDown()

func (*ChatView) ScrollUp

func (cv *ChatView) ScrollUp()

func (*ChatView) SetChatManager

func (cv *ChatView) SetChatManager(chatManager *ChatManager)

type InputView

type InputView struct {
	// contains filtered or unexported fields
}

func NewInputView

func NewInputView(name string, dim ViewDimensionHandler, maxLength int) *InputView

func (*InputView) Edit

func (cv *InputView) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)

func (*InputView) Layout

func (cv *InputView) Layout(g *gocui.Gui) error

func (*InputView) SetChatManager

func (cv *InputView) SetChatManager(chatManager *ChatManager)

type ViewDimensionHandler

type ViewDimensionHandler func(maxX, maxY int) (x, y, w, h int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL