lib

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SemVer is the semantic version of this program
	SemVer = "0.2.1"
)

Variables

View Source
var (
	// ErrorDisconnected indicates that this socket is disconnected.
	ErrorDisconnected = errors.New("Socket is disconnected")
)

Functions

func AnsiFormatLineParts

func AnsiFormatLineParts(lineParts []string, outputItalics bool) string

AnsiFormatLineParts takes line parts and returns a formatted string with ANSI codes.

func SplitLineIntoParts

func SplitLineIntoParts(line string) []string

SplitLineIntoParts splits the given IRC line into separate parts.

Types

type Connection

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

func NewConnection

func NewConnection(config ConnectionConfig, hiddenCommands *map[string]bool) (*Connection, error)

NewConnection returns a new Connection.

func (*Connection) Disconnect

func (conn *Connection) Disconnect()

Disconnect disconnects from the server.

func (*Connection) GetLine

func (conn *Connection) GetLine() (string, error)

GetLine returns a single line from our socket.

func (*Connection) SendLine

func (conn *Connection) SendLine(line string) error

SendLine sends an IRC line to the socket.

func (*Connection) SendMessage

func (conn *Connection) SendMessage(print bool, tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error

SendMessage assembles and sends an IRC message to the socket.

type ConnectionConfig

type ConnectionConfig struct {
	Host      string
	Port      int
	TLS       bool
	TLSConfig *tls.Config
}

type Socket

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

Socket appropriately buffers IRC lines.

func ConnectSocket

func ConnectSocket(host string, port int, useTLS bool, tlsConfig *tls.Config) (*Socket, error)

ConnectSocket connects to the given host/port and starts our receivers if appropriate.

func MakeSocket added in v0.2.0

func MakeSocket(conn net.Conn) *Socket

MakeSocket makes a socket from the given connection.

func (*Socket) Connected

func (s *Socket) Connected() bool

Connected returns true if we're still connected

func (*Socket) Disconnect

func (s *Socket) Disconnect()

Disconnect severs our connection to the server.

func (*Socket) GetLine

func (s *Socket) GetLine() (string, error)

GetLine returns a single IRC line from the socket.

func (*Socket) SendLine

func (s *Socket) SendLine(line string) error

SendLine sends a single IRC line to the socket

Jump to

Keyboard shortcuts

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