mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
rename Account.Deliver to Account.DeliverDestination
the name was too generic compared with the other Deliver functions
This commit is contained in:
parent
3620d6f05e
commit
ca5ef645f3
4 changed files with 6 additions and 6 deletions
2
ctl.go
2
ctl.go
|
@ -340,7 +340,7 @@ func servectlcmd(ctx context.Context, ctl *ctl, shutdown func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.WithWLock(func() {
|
a.WithWLock(func() {
|
||||||
err := a.Deliver(log, addr, m, msgFile, true)
|
err := a.DeliverDestination(log, addr, m, msgFile, true)
|
||||||
ctl.xcheck(err, "delivering message")
|
ctl.xcheck(err, "delivering message")
|
||||||
log.Info("message delivered through ctl", mlog.Field("to", to))
|
log.Info("message delivered through ctl", mlog.Field("to", to))
|
||||||
})
|
})
|
||||||
|
|
|
@ -219,7 +219,7 @@ func Add(ctx context.Context, log *mlog.Log, senderAccount string, mailFrom, rcp
|
||||||
conf, _ := acc.Conf()
|
conf, _ := acc.Conf()
|
||||||
dest := conf.Destinations[mailFrom.String()]
|
dest := conf.Destinations[mailFrom.String()]
|
||||||
acc.WithWLock(func() {
|
acc.WithWLock(func() {
|
||||||
err = acc.Deliver(log, dest, &m, msgFile, consumeFile)
|
err = acc.DeliverDestination(log, dest, &m, msgFile, consumeFile)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("delivering message: %v", err)
|
return 0, fmt.Errorf("delivering message: %v", err)
|
||||||
|
|
|
@ -1650,12 +1650,12 @@ func (a *Account) MessageReader(m Message) *MsgReader {
|
||||||
return &MsgReader{prefix: m.MsgPrefix, path: a.MessagePath(m.ID), size: m.Size}
|
return &MsgReader{prefix: m.MsgPrefix, path: a.MessagePath(m.ID), size: m.Size}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deliver delivers an email to dest, based on the configured rulesets.
|
// DeliverDestination delivers an email to dest, based on the configured rulesets.
|
||||||
//
|
//
|
||||||
// Caller must hold account wlock (mailbox may be created).
|
// Caller must hold account wlock (mailbox may be created).
|
||||||
// Message delivery, possible mailbox creation, and updated mailbox counts are
|
// Message delivery, possible mailbox creation, and updated mailbox counts are
|
||||||
// broadcasted.
|
// broadcasted.
|
||||||
func (a *Account) Deliver(log *mlog.Log, dest config.Destination, m *Message, msgFile *os.File, consumeFile bool) error {
|
func (a *Account) DeliverDestination(log *mlog.Log, dest config.Destination, m *Message, msgFile *os.File, consumeFile bool) error {
|
||||||
var mailbox string
|
var mailbox string
|
||||||
rs := MessageRuleset(log, dest, m, m.MsgPrefix, msgFile)
|
rs := MessageRuleset(log, dest, m, m.MsgPrefix, msgFile)
|
||||||
if rs != nil {
|
if rs != nil {
|
||||||
|
|
|
@ -70,7 +70,7 @@ func TestMailbox(t *testing.T) {
|
||||||
}
|
}
|
||||||
acc.WithWLock(func() {
|
acc.WithWLock(func() {
|
||||||
conf, _ := acc.Conf()
|
conf, _ := acc.Conf()
|
||||||
err := acc.Deliver(xlog, conf.Destinations["mjl"], &m, msgFile, false)
|
err := acc.DeliverDestination(xlog, conf.Destinations["mjl"], &m, msgFile, false)
|
||||||
tcheck(t, err, "deliver without consume")
|
tcheck(t, err, "deliver without consume")
|
||||||
|
|
||||||
err = acc.DB.Write(ctxbg, func(tx *bstore.Tx) error {
|
err = acc.DB.Write(ctxbg, func(tx *bstore.Tx) error {
|
||||||
|
@ -108,7 +108,7 @@ func TestMailbox(t *testing.T) {
|
||||||
})
|
})
|
||||||
tcheck(t, err, "deliver as sent and rejects")
|
tcheck(t, err, "deliver as sent and rejects")
|
||||||
|
|
||||||
err = acc.Deliver(xlog, conf.Destinations["mjl"], &mconsumed, msgFile, true)
|
err = acc.DeliverDestination(xlog, conf.Destinations["mjl"], &mconsumed, msgFile, true)
|
||||||
tcheck(t, err, "deliver with consume")
|
tcheck(t, err, "deliver with consume")
|
||||||
|
|
||||||
err = acc.DB.Write(ctxbg, func(tx *bstore.Tx) error {
|
err = acc.DB.Write(ctxbg, func(tx *bstore.Tx) error {
|
||||||
|
|
Loading…
Reference in a new issue