aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2023-05-09 17:19:43 +0200
committerRobin Jarry <robin@jarry.cc>2023-05-16 13:56:58 +0200
commitecfb22ad85bffb76b814b60ed82b48d0a245b32b (patch)
tree16598cb7ec811e72a2eb1a7ca7bf46543f63aaee
parent2040fc1885ca4b4bea07d91e9fc6a0aaebfe7133 (diff)
downloadaerc-ecfb22ad85bffb76b814b60ed82b48d0a245b32b.tar.gz
aerc-ecfb22ad85bffb76b814b60ed82b48d0a245b32b.zip
archive: respect delimiter
Since we now have support for using a server's custom delimiter, it's only right to also make use of this circumstance in the :archive command. Use the provided delimiter to join the path elements in the :archive command. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--CHANGELOG.md4
-rw-r--r--commands/msg/archive.go16
2 files changed, 15 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 95043c45..a4b73809 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
in `aerc.conf`.
- IMAP now uses the delimiter advertised by the server
+### Fixed
+
+- `:archive` now works on servers using a different delimiter
+
## [0.15.2](https://git.sr.ht/~rjarry/aerc/refs/0.15.2) - 2023-05-11
### Fixed
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index aeb65738..1c9d7929 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -3,7 +3,7 @@ package msg
import (
"errors"
"fmt"
- "path"
+ "strings"
"sync"
"git.sr.ht/~rjarry/aerc/commands"
@@ -70,15 +70,21 @@ func archive(aerc *widgets.Aerc, msgs []*models.MessageInfo, archiveType string)
switch archiveType {
case ARCHIVE_MONTH:
uidMap = groupBy(msgs, func(msg *models.MessageInfo) string {
- dir := path.Join(archiveDir,
+ dir := strings.Join([]string{
+ archiveDir,
fmt.Sprintf("%d", msg.Envelope.Date.Year()),
- fmt.Sprintf("%02d", msg.Envelope.Date.Month()))
+ fmt.Sprintf("%02d", msg.Envelope.Date.Month()),
+ }, aerc.SelectedAccount().Worker().PathSeparator(),
+ )
return dir
})
case ARCHIVE_YEAR:
uidMap = groupBy(msgs, func(msg *models.MessageInfo) string {
- dir := path.Join(archiveDir, fmt.Sprintf("%v",
- msg.Envelope.Date.Year()))
+ dir := strings.Join([]string{
+ archiveDir,
+ fmt.Sprintf("%v", msg.Envelope.Date.Year()),
+ }, aerc.SelectedAccount().Worker().PathSeparator(),
+ )
return dir
})
case ARCHIVE_FLAT: