Add hashes getter to StateEvent
This commit is contained in:
parent
ce2d5a0d9b
commit
8650f8fea7
@ -3,7 +3,7 @@ use std::{collections::BTreeMap, convert::TryFrom};
|
|||||||
use ruma::{
|
use ruma::{
|
||||||
events::{
|
events::{
|
||||||
from_raw_json_value,
|
from_raw_json_value,
|
||||||
pdu::{Pdu, PduStub},
|
pdu::{EventHash, Pdu, PduStub},
|
||||||
room::member::{MemberEventContent, MembershipState},
|
room::member::{MemberEventContent, MembershipState},
|
||||||
EventDeHelper, EventType,
|
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 {
|
pub fn is_type_and_key(&self, ev_type: EventType, state_key: &str) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::Full(ev) => match ev {
|
Self::Full(ev) => match ev {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user