irc

package
v0.0.0-...-d8804ad Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CRLF = "\r\n"

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities map[string]string

type Channel

type Channel struct {
	// Channel name
	Name string

	// Channel topic
	Topic string

	// Channel messages history
	History string

	// Date of the last message we received in this channel
	LastUpdatedDate time.Time

	// Users in this channel
	// The map key is the user's nickname
	// and the user struct holds data about that user
	// such as, prefixes in this channel and etc...
	Users map[string]User
}

func (*Channel) AppendMsg

func (c *Channel) AppendMsg(datetime time.Time, fullMsg string, opts MsgFmtOpts)

type Client

type Client struct {
	// tcp connection
	TCPConn net.Conn

	// Host that client is connected to
	Host string

	// Port that client is connected to
	Port string

	// Nickname currently in use by the user
	Nickname string

	// The root of the doubly linked list of channel
	RootChannel *Node[Channel]

	// Active channel
	ActiveChannel *Node[Channel]

	// The channel to join immediately after registration completes.
	InitialChannel string

	// Reference to the bubbletea program
	Tea *tea.Program

	// The acknowledged capabilities
	EnabledCapabilities Capabilities

	// The features currently enabled for this client
	EnabledFeatures Features
}

func (*Client) AppendChannel

func (c *Client) AppendChannel(channel Channel) *Node[Channel]

func (*Client) Initialize

func (c *Client) Initialize(host string, port string, tlsEnabled bool)

func (*Client) Register

func (c *Client) Register(nick string, password string, channel string)

func (*Client) RemoveChannel

func (c *Client) RemoveChannel(channel *Node[Channel])

func (*Client) SendCommand

func (c *Client) SendCommand(cmd string, params ...string)

type Features

type Features map[string]string

type Message

type Message struct {
	DateTime   time.Time
	Tags       MessageTags // starts with @ | Optional
	Source     string      // starts with : | Optional
	Command    string      // can either be a string or a numeric value | Required
	Parameters []string    // Optional (Dependant on command)
}

func (*Message) SetTimestamp

func (m *Message) SetTimestamp()

type MessageTags

type MessageTags map[string]string

type MsgFmtOpts

type MsgFmtOpts struct {
	WithTimestamp bool
	// TODO: make these a bitset? they should compliment eachother instead of conflicting or rendering twice.
	AsServerMsg bool
	AsErrorMsg  bool

	NotImpl bool
}

type Node

type Node[T any] struct {
	Next  *Node[T]
	Prev  *Node[T]
	Value T
}

type User

type User struct {
	// User prefix in channel
	Prefix string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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