Add origin getter to StateEvent

This commit is contained in:
Devin Ragotzy 2020-08-18 16:03:24 -04:00
parent 8650f8fea7
commit bafc2016c6

View File

@ -201,6 +201,18 @@ impl StateEvent {
},
}
}
pub fn origin(&self) -> String {
match self {
Self::Full(ev) => match ev {
Pdu::RoomV1Pdu(ev) => ev.origin.clone(),
Pdu::RoomV3Pdu(ev) => ev.origin.clone(),
},
Self::Sync(ev) => match ev {
PduStub::RoomV1PduStub(ev) => ev.origin.clone(),
PduStub::RoomV3PduStub(ev) => ev.origin.clone(),
},
}
}
pub fn prev_event_ids(&self) -> Vec<EventId> {
match self {