From 16b845c0d77535ea306339f7a8bd22fc72f8a3c5 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 25 Oct 2017 08:17:17 -0400 Subject: Differentiate between installed and activated states for plugins (#7706) --- plugin/pluginenv/environment.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugin/pluginenv/environment.go') diff --git a/plugin/pluginenv/environment.go b/plugin/pluginenv/environment.go index 805b33e66..37bd1a482 100644 --- a/plugin/pluginenv/environment.go +++ b/plugin/pluginenv/environment.go @@ -89,6 +89,20 @@ func (env *Environment) ActivePluginIds() (ids []string) { return } +// Returns true if the plugin is active, false otherwise. +func (env *Environment) IsPluginActive(pluginId string) bool { + env.mutex.RLock() + defer env.mutex.RUnlock() + + for id := range env.activePlugins { + if id == pluginId { + return true + } + } + + return false +} + // Activates the plugin with the given id. func (env *Environment) ActivatePlugin(id string) error { env.mutex.Lock() -- cgit v1.2.3-1-g7c22