mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
move config-changing code from package mox-/ to admin/
needed for upcoming changes, where (now) package admin needs to import package store. before, because package store imports mox- (for accessing the active config), that would lead to a cyclic import. package mox- keeps its active config, package admin has the higher-level config-changing functions.
This commit is contained in:
@ -33,6 +33,7 @@ import (
|
||||
"github.com/mjl-/sherpadoc"
|
||||
"github.com/mjl-/sherpaprom"
|
||||
|
||||
"github.com/mjl-/mox/admin"
|
||||
"github.com/mjl-/mox/config"
|
||||
"github.com/mjl-/mox/dkim"
|
||||
"github.com/mjl-/mox/dns"
|
||||
@ -1986,7 +1987,7 @@ func parseListID(s string) (listID string, dom dns.Domain) {
|
||||
func (Webmail) RulesetAdd(ctx context.Context, rcptTo string, ruleset config.Ruleset) {
|
||||
reqInfo := ctx.Value(requestInfoCtxKey).(requestInfo)
|
||||
|
||||
err := mox.AccountSave(ctx, reqInfo.Account.Name, func(acc *config.Account) {
|
||||
err := admin.AccountSave(ctx, reqInfo.Account.Name, func(acc *config.Account) {
|
||||
dest, ok := acc.Destinations[rcptTo]
|
||||
if !ok {
|
||||
// todo: we could find the catchall address and add the rule, or add the address explicitly.
|
||||
@ -2007,7 +2008,7 @@ func (Webmail) RulesetAdd(ctx context.Context, rcptTo string, ruleset config.Rul
|
||||
func (Webmail) RulesetRemove(ctx context.Context, rcptTo string, ruleset config.Ruleset) {
|
||||
reqInfo := ctx.Value(requestInfoCtxKey).(requestInfo)
|
||||
|
||||
err := mox.AccountSave(ctx, reqInfo.Account.Name, func(acc *config.Account) {
|
||||
err := admin.AccountSave(ctx, reqInfo.Account.Name, func(acc *config.Account) {
|
||||
dest, ok := acc.Destinations[rcptTo]
|
||||
if !ok {
|
||||
xcheckuserf(ctx, errors.New("destination address not found in account"), "looking up address")
|
||||
|
Reference in New Issue
Block a user