plugin

package
v0.0.0-...-0d01ef4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: BSD-1-Clause Imports: 4 Imported by: 0

README

plugin

This package contains some plugin related utility functions.

Usage

go get github.com/jteeuwen/ircb/plugin

License

Unless otherwise stated, all of the work in this project is subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.

Documentation

Overview

This package contains some plugin related utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(profile string, c *proto.Client) (err error)

Load is called in the bot initialization and allows all registered plugins to initialize any necessary resources.

func Register

func Register(pf PluginFunc)

Register registers a new plugin constructor. This is typically called in the init() function of a plugin package.

func Unload

func Unload(c *proto.Client)

Unload unloads all plugin resources.

Types

type Base

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

Base represents a single plugin instance. It takes care of some basic housekeeping.

func New

func New(profile, name string) *Base

New creates a new plugin base with the given profile and name.

func (*Base) Load

func (p *Base) Load(*proto.Client) error

func (*Base) LoadConfig

func (p *Base) LoadConfig() *ini.File

LoadConfig reads the ini configuration file for the given plugin. Returns nil if the file does not exist.

func (*Base) Name

func (p *Base) Name() string

func (*Base) Profile

func (p *Base) Profile() string

func (*Base) Unload

func (p *Base) Unload(*proto.Client)

type Plugin

type Plugin interface {
	Load(*proto.Client) error
	Unload(*proto.Client)
	LoadConfig() *ini.File
	Name() string
	Profile() string
}

type PluginFunc

type PluginFunc func(string) Plugin

PluginFunc represents a plugin constructor.

Jump to

Keyboard shortcuts

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