(be module.Storage, ctx *cli.Context)
| 39 | } |
| 40 | |
| 41 | func imapAcctAppendlimit(be module.Storage, ctx *cli.Context) error { |
| 42 | username := ctx.Args().First() |
| 43 | if username == "" { |
| 44 | return cli.Exit("Error: USERNAME is required", 2) |
| 45 | } |
| 46 | |
| 47 | u, err := be.GetIMAPAcct(username) |
| 48 | if err != nil { |
| 49 | return err |
| 50 | } |
| 51 | userAL, ok := u.(AppendLimitUser) |
| 52 | if !ok { |
| 53 | return cli.Exit("Error: module.Storage does not support per-user append limit", 2) |
| 54 | } |
| 55 | |
| 56 | if ctx.IsSet("value") { |
| 57 | val := ctx.Int("value") |
| 58 | |
| 59 | var err error |
| 60 | if val == -1 { |
| 61 | err = userAL.SetMessageLimit(nil) |
| 62 | } else { |
| 63 | val32 := uint32(val) |
| 64 | err = userAL.SetMessageLimit(&val32) |
| 65 | } |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | } else { |
| 70 | lim := userAL.CreateMessageLimit() |
| 71 | if lim == nil { |
| 72 | fmt.Println("No limit") |
| 73 | } else { |
| 74 | fmt.Println(*lim) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return nil |
| 79 | } |
no test coverage detected