Forked the emersion/go-imap v1 project.

This commit is contained in:
2025-05-01 11:58:18 +03:00
commit bcc3f95e8e
107 changed files with 16268 additions and 0 deletions

40
imapserver/move.go Normal file
View File

@@ -0,0 +1,40 @@
package imapserver
import (
"github.com/emersion/go-imap/v2"
"github.com/emersion/go-imap/v2/internal/imapwire"
)
func (c *Conn) handleMove(dec *imapwire.Decoder, numKind NumKind) error {
numSet, dest, err := readCopy(numKind, dec)
if err != nil {
return err
}
if err := c.checkState(imap.ConnStateSelected); err != nil {
return err
}
session, ok := c.session.(SessionMove)
if !ok {
return newClientBugError("MOVE is not supported")
}
w := &MoveWriter{conn: c}
return session.Move(w, numSet, dest)
}
// MoveWriter writes responses for the MOVE command.
//
// Servers must first call WriteCopyData once, then call WriteExpunge any
// number of times.
type MoveWriter struct {
conn *Conn
}
// WriteCopyData writes the untagged COPYUID response for a MOVE command.
func (w *MoveWriter) WriteCopyData(data *imap.CopyData) error {
return w.conn.writeCopyOK("", data)
}
// WriteExpunge writes an EXPUNGE response for a MOVE command.
func (w *MoveWriter) WriteExpunge(seqNum uint32) error {
return w.conn.writeExpunge(seqNum)
}