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

Function mboxesCreate

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

Source from the content-addressed store, hash-verified

453}
454
455func 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
485func mboxesRemove(be module.Storage, ctx *cli.Context) error {
486 username := ctx.Args().First()

Callers 1

initFunction · 0.85

Calls 6

ArgsMethod · 0.80
IsSetMethod · 0.80
CreateMailboxSpecialMethod · 0.80
GetIMAPAcctMethod · 0.65
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected