grammers icon indicating copy to clipboard operation
grammers copied to clipboard

Document semantics for Update

Open KaiserKarel opened this issue 6 months ago • 1 comments

Currently it is not fully clear how the return type of Client::next_update should be handled. For example in the case of MessageDeletion, what does it mean if channel_id is None? Which chat should messages be deleted from then?

KaiserKarel avatar Jun 05 '25 13:06 KaiserKarel

Note that updates have just been overhauled in the Git version.

Currently grammers-client exposes way too many raw types (anything from grammers-tl-types), when it should instead expose customly-made types that make it pleasant to use. channel_id is an example of that. It should be an Option<Chat>, but many things have been added "because they're better than nothing".

Perhaps that update should now (re-)expose the newly-added MessageBox:

https://github.com/Lonami/grammers/blob/d75c9cdb5941efebc2ead3eb1d00d8b97123e1bb/lib/grammers-session/src/message_box/defs.rs#L150-L156

Because that's what channel_id indicates. The MessageDeletion update affects either the MessageBox::Common or MessageBox::Channel, thus, you cannot know which specific chat the message was deleted on, only that it belonged to the common message box (i.e. any user or small chat).

Lonami avatar Jun 05 '25 14:06 Lonami

Ah so for my understanding, the message_ids in the common box are shared?

KaiserKarel avatar Jun 10 '25 18:06 KaiserKarel

Yes. If two different people message you privately one after the other, their message IDs will be N and N+1.

Lonami avatar Jun 11 '25 20:06 Lonami