From 73dc39c6ee0827fc68b93af8dc438b0e1c14e929 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Wed, 14 Aug 2024 16:59:11 +0200 Subject: 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 Tested-by: Inwit Tested-by: Tim Culverhouse --- worker/mbox/io.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'worker/mbox/io.go') diff --git a/worker/mbox/io.go b/worker/mbox/io.go index f5fbc596..22d0d023 100644 --- a/worker/mbox/io.go +++ b/worker/mbox/io.go @@ -12,7 +12,6 @@ import ( func Read(r io.Reader) ([]rfc822.RawMessage, error) { mbr := mbox.NewReader(r) - uid := uint32(0) messages := make([]rfc822.RawMessage, 0) for { msg, err := mbr.NextMessage() @@ -28,10 +27,10 @@ func Read(r io.Reader) ([]rfc822.RawMessage, error) { } messages = append(messages, &message{ - uid: uid, flags: models.SeenFlag, content: content, + uid: uidFromContents(content), + flags: models.SeenFlag, + content: content, }) - - uid++ } return messages, nil } -- cgit