aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/archive.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-08-14 16:59:11 +0200
committerRobin Jarry <robin@jarry.cc>2024-08-28 12:06:01 +0200
commit73dc39c6ee0827fc68b93af8dc438b0e1c14e929 (patch)
treeaff067600ea6326ff179447ed968b6712013b889 /commands/msg/archive.go
parent2950d919a5c5a55bd0eb53d6c41f989d8b70bd55 (diff)
downloadaerc-73dc39c6ee0827fc68b93af8dc438b0e1c14e929.tar.gz
treewide: replace uint32 uids with opaque strings
Add a new models.UID type (an alias to string). Replace all occurrences of uint32 being used as message UID or thread UID with models.UID. Update all workers to only expose models.UID values and deal with the conversion internally. Only IMAP needs to convert these to uint32. All other backends already use plain strings as message identifiers, in which case no conversion is even needed. The directory tree implementation needed to be heavily refactored in order to accommodate thread UID not being usable as a list index. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/msg/archive.go')
-rw-r--r--commands/msg/archive.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 8c5f12b9..c262de41 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -89,7 +89,7 @@ func archive(msgs []*models.MessageInfo, mfs *types.MultiFileStrategy,
if err != nil {
return err
}
- var uids []uint32
+ var uids []models.UID
for _, msg := range msgs {
uids = append(uids, msg.Uid)
}
@@ -98,7 +98,7 @@ func archive(msgs []*models.MessageInfo, mfs *types.MultiFileStrategy,
marker.ClearVisualMark()
next := findNextNonDeleted(uids, store)
- var uidMap map[string][]uint32
+ var uidMap map[string][]models.UID
switch archiveType {
case ARCHIVE_MONTH:
uidMap = groupBy(msgs, func(msg *models.MessageInfo) string {
@@ -120,7 +120,7 @@ func archive(msgs []*models.MessageInfo, mfs *types.MultiFileStrategy,
return dir
})
case ARCHIVE_FLAT:
- uidMap = make(map[string][]uint32)
+ uidMap = make(map[string][]models.UID)
uidMap[archiveDir] = commands.UidsFromMessageInfos(msgs)
}
@@ -164,8 +164,8 @@ func archive(msgs []*models.MessageInfo, mfs *types.MultiFileStrategy,
func groupBy(msgs []*models.MessageInfo,
grouper func(*models.MessageInfo) string,
-) map[string][]uint32 {
- m := make(map[string][]uint32)
+) map[string][]models.UID {
+ m := make(map[string][]models.UID)
for _, msg := range msgs {
group := grouper(msg)
m[group] = append(m[group], msg.Uid)