(be module.Storage, ctx *cli.Context)
| 587 | } |
| 588 | |
| 589 | func msgsRemove(be module.Storage, ctx *cli.Context) error { |
| 590 | username := ctx.Args().First() |
| 591 | if username == "" { |
| 592 | return cli.Exit("Error: USERNAME is required", 2) |
| 593 | } |
| 594 | name := ctx.Args().Get(1) |
| 595 | if name == "" { |
| 596 | return cli.Exit("Error: MAILBOX is required", 2) |
| 597 | } |
| 598 | seqset := ctx.Args().Get(2) |
| 599 | if seqset == "" { |
| 600 | return cli.Exit("Error: SEQSET is required", 2) |
| 601 | } |
| 602 | |
| 603 | if !ctx.Bool("uid") { |
| 604 | fmt.Fprintln(os.Stderr, "WARNING: --uid=true will be the default in 0.7") |
| 605 | } |
| 606 | |
| 607 | seq, err := imap.ParseSeqSet(seqset) |
| 608 | if err != nil { |
| 609 | return err |
| 610 | } |
| 611 | |
| 612 | u, err := be.GetIMAPAcct(username) |
| 613 | if err != nil { |
| 614 | return err |
| 615 | } |
| 616 | |
| 617 | _, mbox, err := u.GetMailbox(name, true, nil) |
| 618 | if err != nil { |
| 619 | return err |
| 620 | } |
| 621 | |
| 622 | if !ctx.Bool("yes") { |
| 623 | if !clitools2.Confirmation("Are you sure you want to delete these messages?", false) { |
| 624 | return errors.New("Cancelled") |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | mboxB := mbox.(*imapsql.Mailbox) |
| 629 | return mboxB.DelMessages(ctx.Bool("uid"), seq) |
| 630 | } |
| 631 | |
| 632 | func msgsCopy(be module.Storage, ctx *cli.Context) error { |
| 633 | username := ctx.Args().First() |
no test coverage detected