squirssi

package module
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 21 Imported by: 0

README

squirssi

An IRC client.

Documentation

Overview

import "code.dopame.me/veonik/squirssi"

Index

Constants

View Source
const (
	InputTextBox screenElement = iota
	StatusBar
	MainWindow
)

Variables

This section is empty.

Functions

func HandleIRCEvent

func HandleIRCEvent(srv *Server, h IRCEventHandler) event.Handler

func HandleUIEvent

func HandleUIEvent(srv *Server, fn UIHandler) event.Handler

func Initialize

func Initialize(m *plugin.Manager) (plugin.Plugin, error)

func Write329

func Write329(win Window, created time.Time)

func Write331

func Write331(win Window)

func Write332

func Write332(win Window, topic string)

func WriteAction

func WriteAction(win Window, nick Nick, message Message)

func WriteCTCP

func WriteCTCP(win Window, target Target, sent bool, message string)

func WriteError

func WriteError(win Window, name, message string)

func WriteEval

func WriteEval(win Window, script string)

func WriteEvalError

func WriteEvalError(win Window, script string)

func WriteEvalResult

func WriteEvalResult(win Window, script string)

func WriteHelp

func WriteHelp(win Window, cmd string, desc string)

func WriteHelpGeneric

func WriteHelpGeneric(win Window, msg string)

func WriteJoin

func WriteJoin(win Window, nick Nick)

func WriteKick

func WriteKick(win Window, kicker Nick, kicked Nick, message string)

func WriteMessage

func WriteMessage(win Window, message string)

func WriteMode

func WriteMode(win Window, nick Nick, mode string)

func WriteModes

func WriteModes(win Window, modes string)

func WriteNick

func WriteNick(wm *WindowManager, nick Nick, newNick Nick)

func WriteNotice

func WriteNotice(win Window, target Target, sent bool, message string)

func WritePart

func WritePart(win Window, nick Nick, message string)

func WritePrefixed

func WritePrefixed(win Window, prefix StyledString, message string) error

func WritePrivmsg

func WritePrivmsg(win Window, nick Nick, message Message)

func WriteQuit

func WriteQuit(wm *WindowManager, nick Nick, message string)

func WriteRaw

func WriteRaw(win Window, raw string)

func WriteTopic

func WriteTopic(win Window, nick Nick, topic string)

func WriteWhois

func WriteWhois(win Window, nick string, args []string)

Types

type Channel

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

func (*Channel) AddUser

func (c *Channel) AddUser(user User)

func (*Channel) AutoScroll

func (c *Channel) AutoScroll() bool

func (*Channel) CurrentLine

func (c *Channel) CurrentLine() int

func (*Channel) DeleteUser

func (c *Channel) DeleteUser(name string) bool

func (*Channel) HasActivity

func (c *Channel) HasActivity() bool

func (*Channel) HasNotice

func (c *Channel) HasNotice() bool

func (*Channel) HasUser

func (c *Channel) HasUser(name string) bool

func (*Channel) Lines

func (c *Channel) Lines() []string

func (*Channel) Modes

func (c *Channel) Modes() string

func (*Channel) Notice

func (c *Channel) Notice()

func (*Channel) ScrollTo

func (c *Channel) ScrollTo(pos int)

func (*Channel) SetUsers

func (c *Channel) SetUsers(users []string)

func (*Channel) Title

func (c *Channel) Title() string

func (*Channel) Topic

func (c *Channel) Topic() string

func (*Channel) Touch

func (c *Channel) Touch()

func (*Channel) UpdateUser

func (c *Channel) UpdateUser(name, newName string) bool

func (*Channel) UserList

func (c *Channel) UserList() []string

func (*Channel) Users

func (c *Channel) Users() []string

func (*Channel) Write

func (c *Channel) Write(p []byte) (n int, err error)

func (*Channel) WriteString

func (c *Channel) WriteString(p string) (n int, err error)

type Command

type Command func(*Server, []string)

type DirectMessage

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

func (*DirectMessage) AutoScroll

func (c *DirectMessage) AutoScroll() bool

func (*DirectMessage) CurrentLine

func (c *DirectMessage) CurrentLine() int

func (*DirectMessage) HasActivity

func (c *DirectMessage) HasActivity() bool

func (*DirectMessage) HasNotice

func (c *DirectMessage) HasNotice() bool

func (*DirectMessage) Lines

func (c *DirectMessage) Lines() []string

func (*DirectMessage) Notice

func (c *DirectMessage) Notice()

func (*DirectMessage) ScrollTo

func (c *DirectMessage) ScrollTo(pos int)

func (*DirectMessage) Title

func (c *DirectMessage) Title() string

func (*DirectMessage) Touch

func (c *DirectMessage) Touch()

func (*DirectMessage) Write

func (c *DirectMessage) Write(p []byte) (n int, err error)

func (*DirectMessage) WriteString

func (c *DirectMessage) WriteString(p string) (n int, err error)

type HistoryManager

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

func NewHistoryManager

func NewHistoryManager() *HistoryManager

func (*HistoryManager) Append

func (hm *HistoryManager) Append(win Window, input widget.ModedText)

func (*HistoryManager) Current

func (hm *HistoryManager) Current(win Window) widget.ModedText

func (*HistoryManager) Insert

func (hm *HistoryManager) Insert(win Window, input widget.ModedText)

func (*HistoryManager) Next

func (hm *HistoryManager) Next(win Window) widget.ModedText

func (*HistoryManager) Previous

func (hm *HistoryManager) Previous(win Window) widget.ModedText

type IRCEvent

type IRCEvent struct {
	Code    string
	Raw     string
	Nick    string // <nick>
	Host    string // <nick>!<usr>@<host>
	Source  string // <host>
	User    string // <usr>
	Target  string
	Message string
	Args    []string
}

func NormalizeIRCEvent

func NormalizeIRCEvent(ev *event.Event) *IRCEvent

type IRCEventHandler

type IRCEventHandler func(srv *Server, ev *IRCEvent)

type Interrupter

type Interrupter func()

type Message

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

func MyMessage

func MyMessage(m string) Message

func SomeMessage

func SomeMessage(m string, myNick Nick) Message

func (Message) String

func (m Message) String() string

type Nick

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

func MyNick

func MyNick(nick string) Nick

func SomeNick

func SomeNick(nick string) Nick

func (Nick) String

func (n Nick) String() string

func (Nick) Styled

func (n Nick) Styled() StyledString

type Server

type Server struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

A Server handles user interaction and displaying screen elements.

func FromPlugins

func FromPlugins(m *plugin.Manager) (*Server, error)

func NewServer

func NewServer(ev *event.Dispatcher, irc *irc.Manager, jsvm *vm.VM) (*Server, error)

NewServer creates a new server.

func (*Server) Close

func (srv *Server) Close()

Close ends the UI session, returning control of stdout.

func (*Server) CurrentNick

func (srv *Server) CurrentNick() string

func (*Server) IRCDoAsync

func (srv *Server) IRCDoAsync(fn func(conn *irc.Connection) error)

func (*Server) OnInterrupt

func (srv *Server) OnInterrupt(fn Interrupter) *Server

func (*Server) Render

func (srv *Server) Render()

Render renders the current state to the screen.

func (*Server) RenderOnly

func (srv *Server) RenderOnly(items ...screenElement)

RenderOnly renders select screen elements rather than the whole screen.

func (*Server) Start

func (srv *Server) Start() error

Start begins the UI event loop and does the initial render.

func (*Server) Update

func (srv *Server) Update()

Update refreshes the state of the UI but stops short of rendering.

type StatusWindow

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

func (*StatusWindow) AutoScroll

func (c *StatusWindow) AutoScroll() bool

func (*StatusWindow) CurrentLine

func (c *StatusWindow) CurrentLine() int

func (*StatusWindow) HasActivity

func (c *StatusWindow) HasActivity() bool

func (*StatusWindow) HasNotice

func (c *StatusWindow) HasNotice() bool

func (*StatusWindow) Lines

func (c *StatusWindow) Lines() []string

func (*StatusWindow) Notice

func (c *StatusWindow) Notice()

func (*StatusWindow) ScrollTo

func (c *StatusWindow) ScrollTo(pos int)

func (*StatusWindow) Title

func (c *StatusWindow) Title() string

func (*StatusWindow) Touch

func (c *StatusWindow) Touch()

func (*StatusWindow) Write

func (c *StatusWindow) Write(p []byte) (n int, err error)

func (*StatusWindow) WriteString

func (c *StatusWindow) WriteString(p string) (n int, err error)

type StyledString

type StyledString struct {
	Style string
	// contains filtered or unexported fields
}

func Styled

func Styled(s, style string) StyledString

func Unstyled

func Unstyled(s string) StyledString

func (StyledString) String

func (s StyledString) String() string

type TabCompleter

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

func NewTabCompleter

func NewTabCompleter() *TabCompleter

func (*TabCompleter) Active

func (t *TabCompleter) Active() bool

func (*TabCompleter) Clear

func (t *TabCompleter) Clear()

func (*TabCompleter) Reset

func (t *TabCompleter) Reset(input string, window Window) string

func (*TabCompleter) Tab

func (t *TabCompleter) Tab() string

type Target

type Target struct {
	Nick
	Me Nick
}

func SomeTarget

func SomeTarget(name string, me string) Target

func (Target) IsChannel

func (n Target) IsChannel() bool

type UIHandler

type UIHandler func(*Server, *event.Event)

type User

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

func SomeUser

func SomeUser(c string) User

func (User) String

func (u User) String() string

type Window

type Window interface {
	io.Writer
	io.StringWriter

	// Title of the Window.
	Title() string
	// Lines returns the contents of the Window.
	Lines() []string

	// CurrentLine returns the bottom-most visible line number, or negative to indicate
	// the window is pinned to the end of input.
	CurrentLine() int
	// ScrollTo sets the current line to pos. Set to negative to pin to the end of input.
	ScrollTo(pos int)
	// AutoScroll returns true if automatic scrolling is currently active.
	AutoScroll() bool

	// Touch clears the activity indicator for the window, it it's set.
	Touch()
	// HasActivity returns true if the Window has new lines since the last touch.
	HasActivity() bool
	// Notice set the notice indicator for this Window.
	Notice()
	// HasNotice returns true if the Window has new lines considered important since last touch.
	HasNotice() bool
	// contains filtered or unexported methods
}

type WindowManager

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

func NewWindowManager

func NewWindowManager(ev *event.Dispatcher) *WindowManager

func (*WindowManager) Active

func (wm *WindowManager) Active() Window

func (*WindowManager) ActiveIndex

func (wm *WindowManager) ActiveIndex() int

func (*WindowManager) Append

func (wm *WindowManager) Append(w Window)

func (*WindowManager) CloseIndex

func (wm *WindowManager) CloseIndex(ch int)

CloseIndex closes a window denoted by tab index.

func (*WindowManager) Index

func (wm *WindowManager) Index(idx int) Window

func (*WindowManager) Len

func (wm *WindowManager) Len() int

func (*WindowManager) Named

func (wm *WindowManager) Named(name string) Window

Named returns the window with the given name, if it exists.

func (*WindowManager) NamedOrActive

func (wm *WindowManager) NamedOrActive(name string) Window

func (*WindowManager) ScrollOffset

func (wm *WindowManager) ScrollOffset(offset int)

ScrollTo scrolls the currently active window up relative to the current line.

func (*WindowManager) ScrollTo

func (wm *WindowManager) ScrollTo(pos int)

ScrollTo scrolls the currently active window to the given position.

func (*WindowManager) SelectIndex

func (wm *WindowManager) SelectIndex(idx int)

func (*WindowManager) SelectNext

func (wm *WindowManager) SelectNext()

func (*WindowManager) SelectPrev

func (wm *WindowManager) SelectPrev()

func (*WindowManager) TabNames

func (wm *WindowManager) TabNames() ([]string, map[int]widget.ActivityType)

func (*WindowManager) Windows

func (wm *WindowManager) Windows() []Window

type WindowWithUserList

type WindowWithUserList interface {
	Window
	// UserList returns the styled list of users.
	UserList() []string
	// Users returns just the usernames in the window.
	Users() []string
	// HasUser returns true if the window contains the given user.
	HasUser(name string) bool
	// UpdateUser updates the user to a new name in the current window.
	UpdateUser(name, newNew string) bool
	// DeleteUser removes the user from the current window.
	DeleteUser(name string) bool
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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