irc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagTraceID string = "trace-id"
	TagSpanID  string = "span-id"
)
View Source
const CTCP_DCC = "DCC"
View Source
const QUEUE_NOTIFIER = "QUEUE_NOTIFIER"

Variables

This section is empty.

Functions

func IsCTCPDCCSEND

func IsCTCPDCCSEND(event girc.CTCPEvent) bool

func IsNewPackAnnounce

func IsNewPackAnnounce(event girc.Event) bool

func IsPendingTransfer

func IsPendingTransfer(event girc.Event) bool

func IsTransferInQueue

func IsTransferInQueue(event girc.Event) bool

func L

func L(ctx context.Context) *zap.Logger

Types

type Client

type Client interface {
	OneshotRequestPack(ctx context.Context, nick string) (*DCCSendMessage, error)
	OnEvent(fn OnEvent)
	IsConnected() bool
	Connect() (err error)
	Close()
}

func NewClient

func NewClient(
	cfg configmodels.IRC,
	services lifecycle.ServiceLifecycle,
	queue *queue.Queue,
	fs *fs.FileSystem,
	publisher message.Publisher,
	subscriber message.Subscriber,
) (Client, error)

type ConnectionStateUpdateMessage

type ConnectionStateUpdateMessage struct {
	Connected bool `json:"connected"`
}

type DCCSendMessage

type DCCSendMessage struct {
	Source      *girc.Source   `json:"source,omitempty"`
	AddrPort    netip.AddrPort `json:"addr_port,omitempty"`
	Filename    string         `json:"filename,omitempty"`
	SizeInBytes uint64         `json:"size_in_bytes,omitempty"`
	PackType    PackType       `json:"pack_type,omitempty"`
	Entry       *entry.Entry   `json:"entry,omitempty"`
}

func ParseCTCPDCCSEND

func ParseCTCPDCCSEND(event girc.CTCPEvent) (*DCCSendMessage, error)

type IRCCustomEvent

type IRCCustomEvent string
const (
	Event_NOTICE_PENDING_TRANSFER   IRCCustomEvent = "event_notice_pending_transfer"
	Event_PRIVMSG_ANNOUNCE_PACK     IRCCustomEvent = "event_privmsg_announce_pack"
	Event_PRIVMSG_TRANSFER_IN_QUEUE IRCCustomEvent = "event_privmsg_transfer_in_queue"
	Event_CONNECTION_STATE_UPDATE   IRCCustomEvent = "event_connection_state_update"
	Event_BOT_STATE_UPDATE          IRCCustomEvent = "event_bot_state_update"
	Event_CTCP_DCC                  IRCCustomEvent = "event_ctcp_dcc"
)

type NewPackAnnounceMessage

type NewPackAnnounceMessage struct {
	Source      *girc.Source `json:"source,omitempty"`
	SizeInBytes uint64       `json:"size_in_bytes,omitempty"`
	Filename    string       `json:"filename,omitempty"`
	Entry       *entry.Entry `json:"entry,omitempty"`
	Pack        int64        `json:"pack,omitempty"`
}

func ParseNewPackAnnounce

func ParseNewPackAnnounce(event girc.Event) (*NewPackAnnounceMessage, error)

type OnEvent

type OnEvent func(
	ctx context.Context,
	event IRCCustomEvent,
	msg interface{},
) (err error)

type PackType

type PackType int
const (
	PackType_PACKLIST PackType = iota
	PackType_OTHER
)

type PendingTransferMessage

type PendingTransferMessage struct {
	Source   *girc.Source  `json:"source,omitempty"`
	Duration time.Duration `json:"duration,omitempty"`
}

func ParsePendingTransfer

func ParsePendingTransfer(event girc.Event) (*PendingTransferMessage, error)

type TransferInQueueMessage

type TransferInQueueMessage struct {
	Source        *girc.Source `json:"source,omitempty"`
	Filename      string       `json:"filename,omitempty"`
	Pack          int64        `json:"pack,omitempty"`
	Position      int          `json:"position,omitempty"`
	TransferLimit int          `json:"transfer_limit,omitempty"`
}

func ParseTransferInQueue

func ParseTransferInQueue(event girc.Event) (*TransferInQueueMessage, error)

Jump to

Keyboard shortcuts

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