7 Commits

Author SHA1 Message Date
Robin Jarry
0ca8087ec9 treewide: replace interface{} with any
Since go 1.18, interface{} can be replaced with any.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Karel Balej <balejk@matfyz.cz>
2025-04-07 10:51:05 +02:00
Robin Jarry
4e545d45fa treewide: fix English spelling
Use codespell to fix typos in code, comments and man pages.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: inwit <inwit@sindominio.net>
2025-01-21 13:39:01 +01:00
Robin Jarry
3d509bbc0d tests: fix error with go 1.24
Fix the following error when running tests with go 1.24:

lib/iterator/iterator_test.go:58:12: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:62:13: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:66:12: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:69:12: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:83:12: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:87:13: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:91:12: non-constant format string in call to (*testing.common).Errorf
lib/iterator/iterator_test.go:94:12: non-constant format string in call to (*testing.common).Errorf

Signed-off-by: Robin Jarry <robin@jarry.cc>
2025-01-16 21:00:38 +01:00
Robin Jarry
73dc39c6ee 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>
2024-08-28 12:06:01 +02:00
Koni Marti
88afe7bb4a store: implement the simplified index handling
Simplify the index handling for moving to the next or previous message.
Same for moving to the next or previous search results. Moving of the
index variable relies on the iterator package's StartIndex and EndIndex
functions.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-27 22:44:39 +02:00
Koni Marti
206665a2d9 iterator: add functionality to move indices
Extract the index acrobatics from the message store and move it to
iterator package for re-use and to add unit tests.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-27 22:44:39 +02:00
Koni Marti
c83ffabf38 iterator: implement iterators over uid/thread data
Implement an iterator framework for uid and thread data. Iterators
ensure that the underlying data is accessed in the right order and
provide an abstraction of the index handling.

Iterators should be used when the order of the uids/threads is
important.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-27 22:44:39 +02:00