Smail/backend/hooks/debug/debug.go
smail f60d3b0880
Some checks are pending
Security Checks / security (push) Waiting to run
整理前后端与测试构建目录并完善配置和安全引导
统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
2026-09-05 19:19:52 +08:00

57 lines
1.2 KiB
Go

package main
import (
"fmt"
"git.pcux.cn/xuans/Smail/dto/parsemail"
"git.pcux.cn/xuans/Smail/hooks/framework"
"git.pcux.cn/xuans/Smail/models"
"git.pcux.cn/xuans/Smail/utils/context"
"os"
)
type Debug struct {
}
func NewDebug() *Debug {
return &Debug{}
}
func (d Debug) SendBefore(ctx *context.Context, email *parsemail.Email) {
fmt.Print("[debug] SendBefore")
}
func (d Debug) SendAfter(ctx *context.Context, email *parsemail.Email, err map[string]error) {
fmt.Print("[debug] SendAfter")
}
func (d Debug) ReceiveParseBefore(ctx *context.Context, email *[]byte) {
fmt.Print("[debug] ReceiveParseBefore")
}
func (d Debug) ReceiveParseAfter(ctx *context.Context, email *parsemail.Email) {
fmt.Print("[debug] ReceiveParseAfter")
email.Status = 5
}
func (d Debug) ReceiveSaveAfter(ctx *context.Context, email *parsemail.Email, ue []*models.UserEmail) {
fmt.Print("[debug] ReceiveSaveAfter")
}
func (d Debug) GetName(ctx *context.Context) string {
return "debug"
}
func (d Debug) SettingsHtml(ctx *context.Context, url string, requestData string) string {
return ""
}
func main() {
if err := framework.CreatePlugin("debug_plugin", NewDebug()).Run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}