whisperfish / presage

A high-level Rust library to help write clients for the Signal Messenger.
GNU Affero General Public License v3.0
99 stars 18 forks source link

Threads iterator #128

Open gferon opened 1 year ago

gferon commented 1 year ago

Right now, one can derive the Thread from a message they receive, and decide to fetch all messages from this thread. This works, but doesn't provide any nice way to list all threads.

The idea is to provide what you need to build the main screen of a messaging app/client (like Signal-Android).

Idea: it should give you a thread, the picture, the name, the last message, the time of the last message and a handle to the iterator for all its messages

Schmiddiii commented 1 year ago

I'm not sure how useful that would really be. We already have methods to get all contacts and groups and as one does not want a static page one would already have to distribute the messages to the different displayed channels and re-order the channels dynamically either way. (And it would probably need two iterators for the messages, one forward and one backward; The last message/time of the last message is not really required as it could be queried by the backwards-iterator).

nanu-c commented 1 year ago

Mhm in Axolotl we do not maintain a different database rather than sled in presage. Actually what we need is a fast way to assemble a dataset for each thread with:

In the current state i need to decrypt all groups, iterate through all threads to get the last message, sort the threads by the timestamp of the message, maintain a fork of presage for the muted boolean and the unread message counter. As i test this on my main signal account with now about 50 groups and 200 contacts, it takes 3-7 seconds for the initial loading of the "dataset" to show the first view. And the hardware is an android phone with 3gb of ram. So everything that could be saved in one place, with one iterator is beautiful :)