aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Thyssen Tishman <johannes@thyssentishman.com>2024-01-22 20:46:52 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-25 23:33:01 +0100
commit73d1bb7cbb726bd4e4f567970526707fdaa4fb67 (patch)
treed2eea6bae7a14f45fbceb3ed8604dc6999221a23
parent0a0ab6da9e2644371041c4246eac91f9fa18514f (diff)
downloadaerc-73d1bb7cbb726bd4e4f567970526707fdaa4fb67.tar.gz
msgstore: create destination folder on store.Append
When appending a message to a folder, always create the destination folder if it doesn't exist. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--lib/msgstore.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index cb81abef..33daa9ff 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -101,6 +101,8 @@ func NewMessageStore(worker *types.Worker,
Deleted: make(map[uint32]interface{}),
Messages: make(map[uint32]*models.MessageInfo),
+ ctx: context.Background(),
+
selectedUid: MagicUid,
// default window height until account is drawn once
scrollLen: 25,
@@ -652,6 +654,11 @@ func (store *MessageStore) Move(uids []uint32, dest string, createDest bool,
func (store *MessageStore) Append(dest string, flags models.Flags, date time.Time,
reader io.Reader, length int, cb func(msg types.WorkerMessage),
) {
+ store.worker.PostAction(&types.CreateDirectory{
+ Directory: dest,
+ Quiet: true,
+ }, nil)
+
store.worker.PostAction(&types.AppendMessage{
Destination: dest,
Flags: flags,