MCPcopy Index your code
hub / github.com/foxcpp/maddy / msgsMove

Function msgsMove

internal/cli/ctl/imap.go:672–712  ·  view source on GitHub ↗
(be module.Storage, ctx *cli.Context)

Source from the content-addressed store, hash-verified

670}
671
672func msgsMove(be module.Storage, ctx *cli.Context) error {
673 username := ctx.Args().First()
674 if username == "" {
675 return cli.Exit("Error: USERNAME is required", 2)
676 }
677 srcName := ctx.Args().Get(1)
678 if srcName == "" {
679 return cli.Exit("Error: SRCMAILBOX is required", 2)
680 }
681 seqset := ctx.Args().Get(2)
682 if seqset == "" {
683 return cli.Exit("Error: SEQSET is required", 2)
684 }
685 tgtName := ctx.Args().Get(3)
686 if tgtName == "" {
687 return cli.Exit("Error: TGTMAILBOX is required", 2)
688 }
689
690 if !ctx.Bool("uid") {
691 fmt.Fprintln(os.Stderr, "WARNING: --uid=true will be the default in 0.7")
692 }
693
694 seq, err := imap.ParseSeqSet(seqset)
695 if err != nil {
696 return err
697 }
698
699 u, err := be.GetIMAPAcct(username)
700 if err != nil {
701 return err
702 }
703
704 _, srcMbox, err := u.GetMailbox(srcName, true, nil)
705 if err != nil {
706 return err
707 }
708
709 moveMbox := srcMbox.(*imapsql.Mailbox)
710
711 return moveMbox.MoveMessages(ctx.Bool("uid"), seq, tgtName)
712}
713
714func msgsList(be module.Storage, ctx *cli.Context) error {
715 username := ctx.Args().First()

Callers 1

initFunction · 0.85

Calls 4

ArgsMethod · 0.80
BoolMethod · 0.80
GetIMAPAcctMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected