mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 15:23:02 +02:00
move core::pdu and core::state_res into core::matrix::
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
4e5b87d0cd
commit
532dfd004d
91 changed files with 266 additions and 205 deletions
22
src/core/matrix/pdu/relation.rs
Normal file
22
src/core/matrix/pdu/relation.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use ruma::events::relation::RelationType;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::implement;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
struct ExtractRelType {
|
||||
rel_type: RelationType,
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
struct ExtractRelatesToEventId {
|
||||
#[serde(rename = "m.relates_to")]
|
||||
relates_to: ExtractRelType,
|
||||
}
|
||||
|
||||
#[implement(super::Pdu)]
|
||||
#[must_use]
|
||||
pub fn relation_type_equal(&self, rel_type: &RelationType) -> bool {
|
||||
self.get_content()
|
||||
.map(|c: ExtractRelatesToEventId| c.relates_to.rel_type)
|
||||
.is_ok_and(|r| r == *rel_type)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue