stdio

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	gateway.Config
	Read      bool
	Access    gateway.AccessLevel
	AvatarURL string
}

Config stores the gateway configuration

type Gateway

type Gateway struct {
	gateway.Common
	network.EventEmitter

	*Config
	In  io.ReadCloser
	Out *log.Logger
}

Gateway relays between stdin/stdout

func New

func New(in io.ReadCloser, out *log.Logger, conf *Config) *Gateway

New initializes a new Gateway struct

func (*Gateway) Ban added in v0.9.0

func (o *Gateway) Ban(uid string) error

Ban user from channel

func (*Gateway) Channel added in v0.9.0

func (o *Gateway) Channel() *gateway.Channel

Channel residing in

func (*Gateway) ChannelUsers added in v0.9.0

func (o *Gateway) ChannelUsers() []gateway.User

ChannelUsers online

func (*Gateway) Kick added in v0.9.0

func (o *Gateway) Kick(uid string) error

Kick user from channel

func (*Gateway) Ping added in v0.9.0

func (o *Gateway) Ping(uid string) (time.Duration, error)

Ping user to calculate RTT in milliseconds

func (*Gateway) Relay

func (o *Gateway) Relay(ev *network.Event, from gateway.Gateway) error

Relay dumps the event content to stdout

func (*Gateway) Run

func (o *Gateway) Run(ctx context.Context) error

Run reads packets and emits an event for each received packet

func (*Gateway) Say added in v0.9.0

func (o *Gateway) Say(s string) error

Say sends a chat message

func (*Gateway) SayPrivate added in v0.9.0

func (o *Gateway) SayPrivate(uid string, s string) error

SayPrivate sends a private chat message to uid

func (*Gateway) SetUserAccess added in v0.9.0

func (o *Gateway) SetUserAccess(uid string, a gateway.AccessLevel) (*gateway.AccessLevel, error)

SetUserAccess overrides accesslevel for a specific user

func (*Gateway) Unban added in v0.9.0

func (o *Gateway) Unban(uid string) error

Unban user from channel

func (*Gateway) User added in v0.9.0

func (o *Gateway) User(uid string) (*gateway.User, error)

User by ID

func (*Gateway) Users added in v0.9.0

func (o *Gateway) Users() map[string]gateway.AccessLevel

Users with non-default access level

Jump to

Keyboard shortcuts

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