core

package
v0.0.0-...-c9273ef Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Message        = event(1)
	SearchResult   = event(2)
	BookResult     = event(3)
	NoResults      = event(4)
	BadServer      = event(5)
	SearchAccepted = event(6)
	MatchesFound   = event(7)
	ServerList     = event(8)
	Ping           = event(9)
	Version        = event(10)
)

Variables

This section is empty.

Functions

func DownloadBook

func DownloadBook(irc *irc.Conn, book string)

DownloadBook sends the book string to the download bot

func DownloadExtractDCCString

func DownloadExtractDCCString(baseDir, dccStr string, progress io.Writer) (string, error)

func Join

func Join(irc *irc.Conn, address string, enableTLS bool) error

Join connects to the irc.irchighway.net server and joins the #ebooks channel

func ParseSearch

func ParseSearch(reader io.Reader) ([]BookDetail, []ParseError)

func ParseSearchFile

func ParseSearchFile(filePath string) ([]BookDetail, []ParseError, error)

ParseSearchFile converts a single search file into an array of BookDetail

func ParseSearchV2

func ParseSearchV2(reader io.Reader) ([]BookDetail, []ParseError)

func SearchBook

func SearchBook(irc *irc.Conn, searchBot string, query string)

SearchBook sends a search query to the search bot

func SendVersionInfo

func SendVersionInfo(irc *irc.Conn, line string, version string)

Send a CTCP Version response

func StartReader

func StartReader(ctx context.Context, irc *irc.Conn, handler EventHandler)

Types

type BookDetail

type BookDetail struct {
	Server string `json:"server"`
	Author string `json:"author"`
	Title  string `json:"title"`
	Format string `json:"format"`
	Size   string `json:"size"`
	Full   string `json:"full"`
}

BookDetail contains the details of a single Book found on the IRC server

type EventHandler

type EventHandler map[event]HandlerFunc

type HandlerFunc

type HandlerFunc func(text string)

type IrcServers

type IrcServers struct {
	ElevatedUsers []string `json:"elevatedUsers"`
	RegularUsers  []string `json:"regularUsers"`
}

func ParseServers

func ParseServers(rawString string) IrcServers

ParseServers parses the complete list of IRC users to get the elevated users which in this case are the download servers

type ParseError

type ParseError struct {
	Line  string `json:"line"`
	Error error  `json:"error"`
}

func (*ParseError) MarshalJSON

func (p *ParseError) MarshalJSON() ([]byte, error)

func (ParseError) String

func (p ParseError) String() string

Jump to

Keyboard shortcuts

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