From eb9bbb66bd7bb6b40517b5423ce45f370325d67c Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Sun, 10 Jul 2016 16:19:53 +0200 Subject: [PATCH] feat: add MOVE, RFC 6851 Signed-off-by: Yvonnick Esnault --- imap/command.go | 4 ++++ imap/imap.go | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/imap/command.go b/imap/command.go index f1f8298..1b5867e 100644 --- a/imap/command.go +++ b/imap/command.go @@ -341,6 +341,10 @@ func defaultCommands() map[string]*CommandConfig { "UID STORE": &CommandConfig{States: sel, Filter: FetchFilter}, "UID COPY": &CommandConfig{States: sel}, + // RFC 6851 + "MOVE": &CommandConfig{States: sel}, + "UID MOVE": &CommandConfig{States: sel}, + // RFC 2087 "SETQUOTA": &CommandConfig{States: auth, Filter: LabelFilter("QUOTA")}, "GETQUOTA": &CommandConfig{States: auth, Filter: LabelFilter("QUOTA")}, diff --git a/imap/imap.go b/imap/imap.go index 20b170a..526ce50 100644 --- a/imap/imap.go +++ b/imap/imap.go @@ -371,6 +371,12 @@ func (c *Client) Copy(seq *SeqSet, mbox string) (cmd *Command, err error) { return c.Send("COPY", seq, c.Quote(UTF7Encode(mbox))) } +// Move moves the specified message(s) to the end of the specified destination +// mailbox. +func (c *Client) Move(seq *SeqSet, mbox string) (cmd *Command, err error) { + return c.Send("MOVE", seq, c.Quote(UTF7Encode(mbox))) +} + // UIDSearch is identical to Search, but the numbers returned in the response // are unique identifiers instead of message sequence numbers. func (c *Client) UIDSearch(spec ...Field) (cmd *Command, err error) { @@ -395,6 +401,12 @@ func (c *Client) UIDCopy(seq *SeqSet, mbox string) (cmd *Command, err error) { return c.Send("UID COPY", seq, c.Quote(UTF7Encode(mbox))) } +// UIDMove is identical to Move, but the seq argument is interpreted as +// containing unique identifiers instead of message sequence numbers. +func (c *Client) UIDMove(seq *SeqSet, mbox string) (cmd *Command, err error) { + return c.Send("UID MOVE", seq, c.Quote(UTF7Encode(mbox))) +} + // SetQuota changes the resource limits of the specified quota root. See RFC // 2087 for additional information. func (c *Client) SetQuota(root string, quota ...*Quota) (cmd *Command, err error) {