mode

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAChannel = errors.New("Not a channel.")

Functions

This section is empty.

Types

type Ban

type Ban struct {
	User
	Src       string
	Hostmask  string
	Timestamp time.Time
}

type ModeChange

type ModeChange struct {
	Action      ModeChangeAction
	Mode        rune
	HasArgument bool
	Argument    string
}

type ModeChangeAction

type ModeChangeAction byte
const (
	ModeChangeAction_Added ModeChangeAction = iota
	ModeChangeAction_Removed
)

type ModeChangeEvent

type ModeChangeEvent struct {
	Host, Ident, Nick, Src string
	Tags                   map[string]string

	Target string
	ModeChange
}

type ModeChangeHandler

type ModeChangeHandler interface {
	Handle(*ModeChangeEvent)
}

Handlers are triggered on incoming mode changes from the server. The handler name corresponds to the mode change that has been done, with the first character being either "+" (add) or "-" (remove) and the second being the mode character. The handler name can also be "*" to handle all mode changes.

Foreground handlers have a guarantee of protocol consistency: all the handlers for one event will have finished before the handlers for the next start processing. They are run in parallel but block the event loop, so care should be taken to ensure these handlers are quick :-)

Background handlers are run in parallel and do not block the event loop. This is useful for things that may need to do significant work.

type ModeChangeHandlerFunc

type ModeChangeHandlerFunc func(*ModeChangeEvent)

HandlerFunc allows a bare function with this signature to implement the Handler interface. It is used by Plugin.HandleFunc.

func (ModeChangeHandlerFunc) Handle

func (hf ModeChangeHandlerFunc) Handle(e *ModeChangeEvent)

type Plugin

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

func New

func New(b bot.Bot, isupportPlugin *isupport.Plugin) *Plugin

Creates a new plugin instance.

func Register

func Register(b bot.Bot, isupportPlugin *isupport.Plugin) *Plugin

Registers this plugin with the bot.

func (*Plugin) Bans

func (p *Plugin) Bans(target string) (banlist []Ban, err error)

Fetches the ban list for a channel.

func (*Plugin) Handle

func (plugin *Plugin) Handle(name string, h ModeChangeHandler) client.Remover

Handle adds the provided handler to the foreground set for the named event. It will return a Remover that allows that handler to be removed again.

func (*Plugin) HandleBG

func (plugin *Plugin) HandleBG(name string, h ModeChangeHandler) client.Remover

HandleBG adds the provided handler to the background set for the named event. It may go away in the future. It will return a Remover that allows that handler to be removed again.

func (*Plugin) HandleFunc

func (plugin *Plugin) HandleFunc(name string, hf ModeChangeHandlerFunc) client.Remover

HandleFunc adds the provided function as a handler in the foreground set for the named event. It will return a Remover that allows that handler to be removed again.

type User

type User struct {
	Nick, Ident, Host string
}

Jump to

Keyboard shortcuts

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