diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-05-14 16:34:42 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-05-14 16:44:59 -0400 |
commit | db213fd0aed98a79ecb1be2c7b7d61c7d983bedf (patch) | |
tree | 7570d4934a2de9e5c50a8d1d133792710d98bc66 /lib | |
parent | b0b3287bbdadad47757f3543a6560494af9175a8 (diff) |
Implement :copy (aka :cp)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msgstore.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index 32edfc5..c4f5326 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -218,7 +218,8 @@ func (store *MessageStore) update() { } } -func (store *MessageStore) Delete(uids []uint32) { +func (store *MessageStore) Delete(uids []uint32, + cb func(msg types.WorkerMessage)) { store.Lock() var set imap.SeqSet @@ -229,6 +230,19 @@ func (store *MessageStore) Delete(uids []uint32) { store.Unlock() - store.worker.PostAction(&types.DeleteMessages{Uids: set}, nil) + store.worker.PostAction(&types.DeleteMessages{Uids: set}, cb) store.update() } + +func (store *MessageStore) Copy(uids []uint32, dest string, + cb func(msg types.WorkerMessage)) { + var set imap.SeqSet + for _, uid := range uids { + set.AddNum(uid) + } + + store.worker.PostAction(&types.CopyMessages{ + Destination: dest, + Uids: set, + }, cb) +} |