mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:54:40 +03:00
deprecate having only localparts in an Account's Destinations, it should always be a full email address
current behaviour isn't intuitive. it's not great to have to attempt parsing the strings as both localpart and email address. so we deprecate the localpart-only behaviour. when we load the config file, and it has localpart-only Destinations keys, we'll change them to full addresses in memory. when an admin causes a write of domains.conf, it'll automatically be fixed. we log an error with a deprecated notice for each localpart-only destinations key. sometime in the future, we can remove the old localpart-only destination support. will be in the release notes then. also start keeping track of update notes that need to make it in the release notes of the next release. for issue #18
This commit is contained in:
@ -115,7 +115,7 @@ func MakeAccountConfig(addr smtp.Address) config.Account {
|
||||
account := config.Account{
|
||||
Domain: addr.Domain.Name(),
|
||||
Destinations: map[string]config.Destination{
|
||||
addr.Localpart.String(): {},
|
||||
addr.String(): {},
|
||||
},
|
||||
RejectsMailbox: "Rejects",
|
||||
JunkFilter: &config.JunkFilter{
|
||||
@ -676,13 +676,7 @@ func AddressAdd(ctx context.Context, address, account string) (rerr error) {
|
||||
for name, d := range a.Destinations {
|
||||
nd[name] = d
|
||||
}
|
||||
var k string
|
||||
if addr.Domain == a.DNSDomain {
|
||||
k = addr.Localpart.String()
|
||||
} else {
|
||||
k = addr.String()
|
||||
}
|
||||
nd[k] = config.Destination{}
|
||||
nd[addr.String()] = config.Destination{}
|
||||
a.Destinations = nd
|
||||
nc.Accounts[account] = a
|
||||
|
||||
@ -727,6 +721,7 @@ func AddressRemove(ctx context.Context, address string) (rerr error) {
|
||||
na.Destinations = map[string]config.Destination{}
|
||||
var dropped bool
|
||||
for name, d := range a.Destinations {
|
||||
// todo deprecated: remove support for localpart-only with default domain as destination address.
|
||||
if !(name == addr.Localpart.String() && a.DNSDomain == addr.Domain || name == addrStr) {
|
||||
na.Destinations[name] = d
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user