Hello,
A relative of mine also has this problem when I send him several messages in a row : I just sent messages 1, 2, 3, 4, 5, 6, and he received them in the exact opposite order. He uses version 1.34.1 on iphone, I use version 1.32.1.
I saw there was a thread about this topic around 2019-2020. The debate was about whether messages should be sorted by the date they were sent or the date they were received. May I suggest another option?
But first, as far as I understand, maybe I should recall the arguments against sent vs received date:
-
received date : if you sort according to received date, the order of reception can be inconsistent with the order the messages were sent (even if there is only one sender and one receiver)
-
sent date : if you sort according to sent date, a delayed message might be placed so high in your list of messages that it is out of sight.
As far as I can tell, there could be a way to avoid inconsistencies, while reducing the risk of a delayed message being placed out of sight.
Messages exchanged by Delta Chat have the usual headers “Message-ID”, “In-Reply-To” and “References”. What about using them to sort messages?
These headers define a partial order on messages : if message y has the “Message-ID” of x in its “References”, that means x must be displayed before y. This order is only partial, since it leaves ties: when two messages y and z are replies to a same message x, it does not prescribe how to order them.
It seems that using this partial order would solve the problem of inconsistent order of messages: you would never have a reply placed before a message. In other words, with the previous example, you may display message x, then y, then z or message x, then z, then y, and none of these orders is inconsistent since neither the sender of y nor the sender of z knew the other one sent (or was about to send) a message.
Now, what about the case of a discussion where a message y replies to x but, because the author of y has no network, y is delayed for a very long time, and many messages z1, z2, …, z100 are exchanged before y really reaches its recipients? The partial order over messages just says that y replies to x and that z1, …, z100 also reply to x. So there’s a tie between y and z1, …, z100. If you break the ties according to the order of reception, y will be placed after z100, so it won’t be out of sight.
Does that make sense?
As far as I can tell, implementing such an order amounts to implement Kahn’s algorithm with a slight twist: keep the set S sorted by received date and choose the first one instead of an arbitrary one.
Your
Judicaël.