summaryrefslogtreecommitdiffstats
path: root/plugin/hooks.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-07-13 10:29:50 -0400
committerGitHub <noreply@github.com>2018-07-13 10:29:50 -0400
commit17f211c393772f30922bac595592e3fe60c2ef25 (patch)
tree4f8dfbe7949022d5da2de2db6d7b762e74fb4582 /plugin/hooks.go
parent5ddb08dcb47f938c9ac3a3e6338d9b3cc61c20a7 (diff)
downloadchat-17f211c393772f30922bac595592e3fe60c2ef25.tar.gz
chat-17f211c393772f30922bac595592e3fe60c2ef25.tar.bz2
chat-17f211c393772f30922bac595592e3fe60c2ef25.zip
MM-11292: clean up plugins GoDoc (#9109)
* clean up plugins GoDoc: - eliminate plugin.NewBlankContext() as unnecessary - export ValidIdRegex as a string vs. the less readable var - add/update various documentation strings - hide everything by default, except where used by client plugins or the mattermost-server. The exception to this rule are the `*(Args|Returns)` structs which must be public for go-plugin, but are now prefixed with `Z_` with a warning not to use. - include a top-level example to get plugin authors started This is not a breaking change for existing plugins compiled against plugins-v2. * remove commented out ServeHTTPResponseWriter * update examples to match developer docs * add missing plugin/doc.go license header
Diffstat (limited to 'plugin/hooks.go')
-rw-r--r--plugin/hooks.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugin/hooks.go b/plugin/hooks.go
index daeffbc32..5200291f2 100644
--- a/plugin/hooks.go
+++ b/plugin/hooks.go
@@ -9,8 +9,10 @@ import (
"github.com/mattermost/mattermost-server/model"
)
-// These assignments are part of the wire protocol. You can add more, but should not change existing
-// assignments. Follow the naming convention of <HookName>Id as the autogenerated glue code depends on that.
+// These assignments are part of the wire protocol used to trigger hook events in plugins.
+//
+// Feel free to add more, but do not change existing assignments. Follow the naming convention of
+// <HookName>Id as the autogenerated glue code depends on that.
const (
OnActivateId = 0
OnDeactivateId = 1
@@ -29,15 +31,16 @@ const (
TotalHooksId = iota
)
-// Methods from the Hooks interface can be used by a plugin to respond to events. Methods are likely
-// to be added over time, and plugins are not expected to implement all of them. Instead, plugins
-// are expected to implement a subset of them and pass an instance to plugin/rpcplugin.Main, which
-// will take over execution of the process and add default behaviors for missing hooks.
+// Hooks describes the methods a plugin may implement to automatically receive the corresponding
+// event.
+//
+// A plugin only need implement the hooks it cares about. The MattermostPlugin provides some
+// default implementations for convenience but may be overridden.
type Hooks interface {
// OnActivate is invoked when the plugin is activated.
OnActivate() error
- // Implemented returns a list of hooks that are implmented by the plugin.
+ // Implemented returns a list of hooks that are implemented by the plugin.
// Plugins do not need to provide an implementation. Any given will be ignored.
Implemented() ([]string, error)