aboutsummaryrefslogtreecommitdiffstats
path: root/commands/account/import-mbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/account/import-mbox.go')
-rw-r--r--commands/account/import-mbox.go44
1 files changed, 22 insertions, 22 deletions
diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go
index 774dfa8f..7aa393b6 100644
--- a/commands/account/import-mbox.go
+++ b/commands/account/import-mbox.go
@@ -65,7 +65,6 @@ func (i ImportMbox) Execute(args []string) error {
app.PushError(err.Error())
return
}
- worker := acct.Worker()
var appended uint32
for i, m := range messages {
@@ -79,27 +78,28 @@ func (i ImportMbox) Execute(args []string) error {
break
}
nbytes, _ := io.Copy(&buf, r)
- worker.PostAction(&types.AppendMessage{
- Destination: folder,
- Flags: models.SeenFlag,
- Date: time.Now(),
- Reader: &buf,
- Length: int(nbytes),
- }, func(msg types.WorkerMessage) {
- switch msg := msg.(type) {
- case *types.Unsupported:
- errMsg := fmt.Sprintf("%s: AppendMessage is unsupported", args[0])
- log.Errorf(errMsg)
- app.PushError(errMsg)
- return
- case *types.Error:
- log.Errorf("AppendMessage failed: %v", msg.Error)
- done <- false
- case *types.Done:
- atomic.AddUint32(&appended, 1)
- done <- true
- }
- })
+ store.Append(
+ folder,
+ models.SeenFlag,
+ time.Now(),
+ &buf,
+ int(nbytes),
+ func(msg types.WorkerMessage) {
+ switch msg := msg.(type) {
+ case *types.Unsupported:
+ errMsg := fmt.Sprintf("%s: AppendMessage is unsupported", args[0])
+ log.Errorf(errMsg)
+ app.PushError(errMsg)
+ return
+ case *types.Error:
+ log.Errorf("AppendMessage failed: %v", msg.Error)
+ done <- false
+ case *types.Done:
+ atomic.AddUint32(&appended, 1)
+ done <- true
+ }
+ },
+ )
select {
case ok := <-done: