diff --git a/src/state_event.rs b/src/state_event.rs index b9ab4e40..8c946730 100644 --- a/src/state_event.rs +++ b/src/state_event.rs @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, convert::TryFrom}; use ruma::{ events::{ from_raw_json_value, - pdu::{Pdu, PduStub}, + pdu::{EventHash, Pdu, PduStub}, room::member::{MemberEventContent, MembershipState}, EventDeHelper, EventType, }, @@ -273,6 +273,19 @@ impl StateEvent { } } + pub fn hashes(&self) -> &EventHash { + match self { + Self::Full(ev) => match ev { + Pdu::RoomV1Pdu(ev) => &ev.hashes, + Pdu::RoomV3Pdu(ev) => &ev.hashes, + }, + Self::Sync(ev) => match ev { + PduStub::RoomV1PduStub(ev) => &ev.hashes, + PduStub::RoomV3PduStub(ev) => &ev.hashes, + }, + } + } + pub fn is_type_and_key(&self, ev_type: EventType, state_key: &str) -> bool { match self { Self::Full(ev) => match ev {