client

package
v0.0.0-...-e1bcdf1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package client implements simple console chat client.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredentials = errors.New("invalid credentials")

ErrInvalidCredentials returned when username or password are incorrect.

Functions

This section is empty.

Types

type Client

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

Client is a console chat client

func NewClient

func NewClient(c Config) Client

NewClient creates new client

func (*Client) DownloadFile

func (c *Client) DownloadFile(fname string) error

DownloadFile gets a file from the chat.

func (*Client) Listen

func (c *Client) Listen() error

Listen logins into chat and monitors it for incoming messages and prints messages to stdout.

func (*Client) SendFile

func (c *Client) SendFile(fname string) error

SendFile sends a file to the chat.

func (*Client) SendText

func (c *Client) SendText(message string) error

SendText sends a plain text message to the chat.

type Config

type Config struct {
	Address       string `json:"address"`
	User          string `json:"user"`
	Password      string `json:"password"`
	Debug         bool   `json:"debug"`
	SSLSkipVerify bool   `json:"ssl_skip_verify"`
	CacheDir      string `json:"-"`
	// contains filtered or unexported fields
}

Config is a client config.

func NewConfig

func NewConfig() Config

NewConfig creates client config

func (*Config) Load

func (c *Config) Load(fname string)

Load loads json config file.

func (*Config) LoadDefault

func (c *Config) LoadDefault()

LoadDefault loads default json config file ~/.config/chat/chatc.json.

func (Config) Print

func (c Config) Print()

Print prints config to stdout.

Jump to

Keyboard shortcuts

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