(be module.Storage, ctx *cli.Context)
| 453 | } |
| 454 | |
| 455 | func mboxesCreate(be module.Storage, ctx *cli.Context) error { |
| 456 | username := ctx.Args().First() |
| 457 | if username == "" { |
| 458 | return cli.Exit("Error: USERNAME is required", 2) |
| 459 | } |
| 460 | name := ctx.Args().Get(1) |
| 461 | if name == "" { |
| 462 | return cli.Exit("Error: NAME is required", 2) |
| 463 | } |
| 464 | |
| 465 | u, err := be.GetIMAPAcct(username) |
| 466 | if err != nil { |
| 467 | return err |
| 468 | } |
| 469 | |
| 470 | if ctx.IsSet("special") { |
| 471 | attr := "\\" + strings.Title(ctx.String("special")) //nolint:staticcheck |
| 472 | // (nolint) strings.Title is perfectly fine there since special mailbox tags will never use Unicode. |
| 473 | |
| 474 | suu, ok := u.(SpecialUseUser) |
| 475 | if !ok { |
| 476 | return cli.Exit("Error: storage backend does not support SPECIAL-USE IMAP extension", 2) |
| 477 | } |
| 478 | |
| 479 | return suu.CreateMailboxSpecial(name, attr) |
| 480 | } |
| 481 | |
| 482 | return u.CreateMailbox(name) |
| 483 | } |
| 484 | |
| 485 | func mboxesRemove(be module.Storage, ctx *cli.Context) error { |
| 486 | username := ctx.Args().First() |
no test coverage detected