ircconnection

package
v0.0.0-...-01eed2d Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SafeString

func SafeString(str string) string

SafeString converts emojis into their corresponding tag, converts Unicode into their matching ASCII representation and removes and left non safe characters in the given str.

Types

type Connection

type Connection struct {
	Caps *capabilities.Map
	// contains filtered or unexported fields
}

Connection represents an IRC connection.

func HandleConnection

func HandleConnection(ctx context.Context, socket *net.TCPConn) *Connection

HandleConnection wraps around the given socket connection, which you shouldn't use after providing it. It will then handle all the IRC connection stuff for you. You should interface with it using it's methods.

func (*Connection) Nick

func (conn *Connection) Nick() string

Nick returns the nickname of the user at the other end of the current connection.

func (*Connection) NickSetChannel

func (conn *Connection) NickSetChannel() <-chan emitter.Event

NickSetChannel returns a channel that fires when the nickname is changed.

func (*Connection) Pass

func (conn *Connection) Pass() string

Pass returns the password of the user at the other end of the current connection.

func (*Connection) PassSetChannel

func (conn *Connection) PassSetChannel() <-chan interface{}

PassSetChannel returns a channel that closes when the password is set, nothing is sent over the channel.

func (*Connection) PrivateMessage

func (conn *Connection) PrivateMessage(date time.Time, from, to, line string) error

PrivateMessage sends the given line as a private message from from, to to, on the the given date.

func (*Connection) ReceiveChannel

func (conn *Connection) ReceiveChannel() <-chan *irc.Message

ReceiveChannel returns the channel where new messages are sent on.

func (*Connection) Status

func (conn *Connection) Status(body string) error

Status writes the given message as if sent by 'status' to the current connection.

func (*Connection) StopChannel

func (conn *Connection) StopChannel() <-chan struct{}

StopChannel returns a channel that closes when the current connection is being shut down. No messages are sent over this channel.

func (*Connection) Write

func (conn *Connection) Write(time time.Time, msg string) error

Write writes the given message with the given timestamp to the connection

func (*Connection) WriteListNow

func (conn *Connection) WriteListNow(messages []string) error

WriteListNow writes the given messages with a timestamp of now to the connection.

func (*Connection) WriteNow

func (conn *Connection) WriteNow(msg string) error

WriteNow writes the given message with a timestamp of now to the connection.

Jump to

Keyboard shortcuts

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