e90d96961f
Restructured the plugin system. Multiple plugins can bind to the same hook now (not available for variadic hooks yet!) The parser is now benchmarked. The bench_round4 is run with both plugin_markdown and plugin_bbcode enabled. Added a benchmark for the BBCode plugin. Moved some of the template writing logic into a more generalised function. URLs are now recognised by the system and linked. Converted more custom errors into LocalError calls. Faster and less bandwidth intensive Emojis on Edge. Fixed a bug with replies not working.
23 lines
698 B
Go
23 lines
698 B
Go
package main
|
|
import "html/template"
|
|
|
|
func init() {
|
|
plugins["helloworld"] = NewPlugin("helloworld","Hello World","Azareal","http://github.com/Azareal","","","",init_helloworld,nil,deactivate_helloworld)
|
|
}
|
|
|
|
// init_helloworld is separate from init() as we don't want the plugin to run if the plugin is disabled
|
|
func init_helloworld() {
|
|
plugins["helloworld"].AddHook("rrow_assign", helloworld_reply)
|
|
}
|
|
|
|
func deactivate_helloworld() {
|
|
plugins["helloworld"].RemoveHook("rrow_assign", helloworld_reply)
|
|
}
|
|
|
|
func helloworld_reply(data interface{}) interface{} {
|
|
reply := data.(Reply)
|
|
reply.Content = "Hello World!"
|
|
reply.ContentHtml = template.HTML("Hello World!")
|
|
reply.Tag = "Auto"
|
|
return reply
|
|
} |