News for hackers. Stuff that matters.
Re:Ten Commandments of How to Write an IMAP Client (2006) by throw0101a on Monday October 28, 2019 @08:00AM (#21376103)
> Basically, all messages in a mailbox are numbered from 1 to N, and you can reference a message by number, and when a message is deleted all message numbers above it shift down by one.

There is no reason technical why this shifting has to happen. If there are ten messages on session creation, and message UID 3 is deleted, you then have UIDs 1-2,4-10.

If the server wishes to shift messages over it can, but it must bump UIDVALIDITY, which tells clients that there is a 'new generation' of UIDs for the given folder. But as long as the server's index of UID-to-message is not lost, there's no reason why renumbering has to occur.

It's no different than having an AUTO_INCREMENT int column in MySQL: you just keep going up without bothering to fill in any 'holes'.

That said, folders and messages can now be assigned UUIDs:

* https://tools.ietf.org/html/rfc8474

Re:Ten Commandments of How to Write an IMAP Client (2006) by jcranmer on Monday October 28, 2019 @09:13AM (#21376616)
GP is talking about message sequence numbers, not UIDs. Message sequence numbers are literally from 1 to N, and should you delete (expunge) a message, the sequence number of everything subsequent is decremented by 1 to keep 1 to N.

It is pretty much impossible to write a modern mail client relying on message sequence numbers, since there are too many ways the bookkeeping go wrong; so everyone uses UIDs (or UUIDs) nowadays wherever possible.