Fixing to have the proper version of go-imap from foxcpp.

This commit is contained in:
2025-12-08 22:52:36 +02:00
parent d8ddb6be71
commit 226c7e6cf0
207 changed files with 15166 additions and 15437 deletions

52
server/cmd_any.go Normal file
View File

@@ -0,0 +1,52 @@
package server
import (
"github.com/emersion/go-imap"
"github.com/emersion/go-imap/backend"
"github.com/emersion/go-imap/commands"
"github.com/emersion/go-imap/responses"
)
type Capability struct {
commands.Capability
}
func (cmd *Capability) Handle(conn Conn) error {
res := &responses.Capability{Caps: conn.Capabilities()}
return conn.WriteResp(res)
}
type Noop struct {
commands.Noop
}
func (cmd *Noop) Handle(conn Conn) error {
ctx := conn.Context()
if ctx.Mailbox != nil {
// If a mailbox is selected, NOOP can be used to poll for server updates
if mbox, ok := ctx.Mailbox.(backend.MailboxPoller); ok {
return mbox.Poll()
}
}
return nil
}
type Logout struct {
commands.Logout
}
func (cmd *Logout) Handle(conn Conn) error {
res := &imap.StatusResp{
Type: imap.StatusRespBye,
Info: "Closing connection",
}
if err := conn.WriteResp(res); err != nil {
return err
}
// Request to close the connection
conn.Context().State = imap.LogoutState
return nil
}