Add to_*_event_stub methods to pdu, filter for correct event kind

When creating some responses (sync) an AnyRoomEventStub is needed for this
PduEvent will deserialize the JSON as a Stub event and a non stub event
when needed. Ephemeral and account events are checked to be the correct
type and filtered out if not. This requires an extra `deserialize` call
which could/should be removed.

TODO: Possibly get rid of EventJson in some places.
This commit is contained in:
Devin R 2020-06-22 07:26:09 -04:00
parent 7c38e53839
commit 24b6702047
3 changed files with 136 additions and 102 deletions

View file

@ -62,6 +62,8 @@ impl RoomEdus {
room_id: &RoomId,
since: u64,
) -> Result<impl Iterator<Item = Result<EventJson<EduEvent>>>> {
// TODO is this ^^^^^^^
// only ever a read receipt could we just return EphemeralRoomEvent here?
let mut prefix = room_id.to_string().as_bytes().to_vec();
prefix.push(0xff);