autolinkplugin

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandHandler

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

func (CommandHandler) Handle

func (ch CommandHandler) Handle(p *Plugin, c *plugin.Context, header *model.CommandArgs, args ...string) *model.CommandResponse

type CommandHandlerFunc

type CommandHandlerFunc func(p *Plugin, c *plugin.Context, header *model.CommandArgs, args ...string) *model.CommandResponse

type Config

type Config struct {
	EnableAdminCommand bool                `json:"enableadmincommand"`
	EnableOnUpdate     bool                `json:"enableonupdate"`
	PluginAdmins       string              `json:"pluginadmins"`
	Links              []autolink.Autolink `json:"links"`

	// AdminUserIds is a set of UserIds that are permitted to perform
	// administrative operations on the plugin configuration (i.e. plugin
	// admins). On each configuration change the contents of PluginAdmins
	// config field is parsed into this field.
	AdminUserIds map[string]struct{} `json:"-"`
}

Config from config.json

func (*Config) Sorted

func (conf *Config) Sorted() *Config

Sorted returns a clone of the Config, with links sorted alphabetically

func (*Config) ToMap

func (conf *Config) ToMap() (map[string]interface{}, error)

ToConfig marshals Config into a tree of map[string]interface{} to pass down to p.API.SavePluginConfig, otherwise RPC/gob barfs at the unknown type.

type Plugin

type Plugin struct {
	plugin.MattermostPlugin
	// contains filtered or unexported fields
}

Plugin the main struct for everything

func New

func New() *Plugin

func (*Plugin) ExecuteCommand

func (p *Plugin) ExecuteCommand(c *plugin.Context, commandArgs *model.CommandArgs) (*model.CommandResponse, *model.AppError)
func (p *Plugin) GetLinks() []autolink.Autolink

func (*Plugin) IsAuthorizedAdmin

func (p *Plugin) IsAuthorizedAdmin(userID string) (bool, error)

func (*Plugin) MessageWillBePosted

func (p *Plugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string)

MessageWillBePosted is invoked when a message is posted by a user before it is committed to the database.

func (*Plugin) MessageWillBeUpdated

func (p *Plugin) MessageWillBeUpdated(c *plugin.Context, post *model.Post, _ *model.Post) (*model.Post, string)

MessageWillBeUpdated is invoked when a message is updated by a user before it is committed to the database.

func (*Plugin) OnActivate

func (p *Plugin) OnActivate() error

func (*Plugin) OnConfigurationChange

func (p *Plugin) OnConfigurationChange() error

OnConfigurationChange is invoked when configuration changes may have been made.

func (*Plugin) ProcessPost

func (p *Plugin) ProcessPost(c *plugin.Context, post *model.Post) (*model.Post, string)
func (p *Plugin) SaveLinks(links []autolink.Autolink) error

func (*Plugin) ServeHTTP

func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)

func (*Plugin) UpdateConfig

func (p *Plugin) UpdateConfig(f func(conf *Config))

Jump to

Keyboard shortcuts

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