diff --git a/main.go b/main.go index 3ab77d11..639c4f15 100644 --- a/main.go +++ b/main.go @@ -89,27 +89,28 @@ func LoadPlugins() { if len(ext) != 2 { continue } - if ext[1] == "so" { - plug, err := plg.Open("plugins/"+f.Name()) - if err != nil { - fmt.Printf("Plugin '%v' could not load correctly.\n", f.Name()) - continue - } - symPlugin, err := plug.Lookup("Plugin") - var plugActions plugin.PluginActions - plugActions, ok := symPlugin.(plugin.PluginActions) - if !ok { - fmt.Printf("Plugin '%v' could not load correctly, error: %v\n", f.Name(), "unexpected type from module symbol") - continue - } - //plugin := plugActions.Plugin() - // - //fmt.Println(plugin.OnLoad) - - plugActions.OnLoad() - - allPlugins = append(allPlugins, plugActions.Plugin()) + if ext[1] != "so" { + continue } + plug, err := plg.Open("plugins/" + f.Name()) + if err != nil { + fmt.Printf("Plugin '%v' could not load correctly.\n", f.Name()) + continue + } + symPlugin, err := plug.Lookup("Plugin") + var plugActions plugin.PluginActions + plugActions, ok := symPlugin.(plugin.PluginActions) + if !ok { + fmt.Printf("Plugin '%v' could not load correctly, error: %v\n", f.Name(), "unexpected type from module symbol") + continue + } + //plugin := plugActions.Plugin() + // + //fmt.Println(plugin.OnLoad) + + plugActions.OnLoad() + + //allPlugins = append(allPlugins, plugActions.Plugin()) } core.Plugins = allPlugins fmt.Printf("Loaded %v Plugins\n", len(allPlugins)) diff --git a/plugin/plugin.go b/plugin/plugin.go index 8ca8e842..df5c26a3 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -26,7 +26,7 @@ type Routing struct { } type PluginActions interface { - Plugin() *PluginInfo + //Plugin() *PluginInfo SaveForm() OnInstall() OnUninstall() @@ -34,8 +34,11 @@ type PluginActions interface { OnHit() OnSettingsSaved() OnNewUser() + OnNewService() OnShutdown() OnLoad() + OnBeforeRequest() + OnAfterRequest() } func SetDatabase(db *sql.DB) { diff --git a/plugins/slack.so b/plugins/slack.so index aebbc981..00d363d7 100644 Binary files a/plugins/slack.so and b/plugins/slack.so differ