Skip to main content

classify_own_response

Function classify_own_response 

Source
pub fn classify_own_response(body: &[u8]) -> Option<UpdatesLike>
Expand description

Parse the raw body of one of our own RPC responses into an UpdatesLike, so self-sent actions (sending/editing/deleting a message, etc.) can be fed back through MessageBoxes::process_updates the same way a pushed update would be. Otherwise the next real update looks like a gap and triggers a spurious getDifference.

This is pure parsing - no Client or lock access. The caller is responsible for locking its MessageBoxes and calling process_updates() with the result.

Safe to call on any response: every TL type is prefixed with a 4-byte constructor ID, and Updates::deserialize checks it before matching a variant. A response that’s neither Updates, a joined-chat invite result, nor messages.AffectedMessages just fails to match and this returns None.