Rebase with key backups and cross signing
Moved back to a fork of ruma with timo's key-backup and cross-signing branch. Ephemeral events in sync responses are EphemeralRoomEventStub (they also have no room_id like all of sync responses events)
This commit is contained in:
parent
84dcb885a7
commit
63e23154f3
File diff suppressed because it is too large
Load Diff
|
@ -2523,13 +2523,6 @@ pub fn sync_route(
|
|||
.edus
|
||||
.roomlatests_since(&room_id, since)?
|
||||
.filter_map(|r| r.ok()) // Filter out buggy events
|
||||
.filter_map(|r| {
|
||||
if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() {
|
||||
Some(EventJson::from(ev))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if db
|
||||
|
@ -2617,13 +2610,6 @@ pub fn sync_route(
|
|||
.edus
|
||||
.roomlatests_since(&room_id, since)?
|
||||
.filter_map(|r| r.ok()) // Filter out buggy events
|
||||
.filter_map(|r| {
|
||||
if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() {
|
||||
Some(EventJson::from(ev))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if db
|
||||
|
@ -2634,9 +2620,9 @@ pub fn sync_route(
|
|||
{
|
||||
edus.push(
|
||||
serde_json::from_str(
|
||||
&serde_json::to_string(&EduEvent::Ephemeral(AnyEphemeralRoomEvent::Typing(
|
||||
&serde_json::to_string(&ruma::events::AnyEphemeralRoomEventStub::Typing(
|
||||
db.rooms.edus.roomactives_all(&room_id)?,
|
||||
)))
|
||||
))
|
||||
.expect("event is valid, we just created it"),
|
||||
)
|
||||
.expect("event is valid, we just created it"),
|
||||
|
|
|
@ -62,6 +62,7 @@ impl Database {
|
|||
.to_owned())
|
||||
})?;
|
||||
|
||||
println!("{:?}", path);
|
||||
let db = sled::open(&path)?;
|
||||
info!("Opened sled database at {}", path);
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ impl RoomEdus {
|
|||
&self,
|
||||
room_id: &RoomId,
|
||||
since: u64,
|
||||
) -> Result<impl Iterator<Item = Result<EventJson<EduEvent>>>> {
|
||||
) -> Result<impl Iterator<Item = Result<EventJson<ruma::events::AnyEphemeralRoomEventStub>>>>
|
||||
{
|
||||
let mut prefix = room_id.to_string().as_bytes().to_vec();
|
||||
prefix.push(0xff);
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ use crate::{Error, Result};
|
|||
use js_int::UInt;
|
||||
use ruma::{
|
||||
events::{
|
||||
pdu::EventHash, AnyRoomEvent, AnyRoomEventStub, AnyStateEvent, AnyStateEventStub,
|
||||
AnyStrippedStateEventStub, EventJson, EventType,
|
||||
pdu::EventHash, room::member::MemberEventContent, AnyRoomEvent, AnyRoomEventStub,
|
||||
AnyStateEvent, AnyStateEventStub, AnyStrippedStateEventStub, EventJson, EventType,
|
||||
StateEvent,
|
||||
},
|
||||
identifiers::{EventId, RoomId, UserId},
|
||||
};
|
||||
|
@ -103,9 +104,9 @@ impl PduEvent {
|
|||
serde_json::from_str::<EventJson<AnyStrippedStateEventStub>>(&json)
|
||||
.expect("EventJson::from_str always works")
|
||||
}
|
||||
pub fn to_member_event(&self) -> EventJson<MemberEvent> {
|
||||
pub fn to_member_event(&self) -> EventJson<StateEvent<MemberEventContent>> {
|
||||
let json = serde_json::to_string(&self).expect("PDUs are always valid");
|
||||
serde_json::from_str::<EventJson<MemberEvent>>(&json)
|
||||
serde_json::from_str::<EventJson<StateEvent<MemberEventContent>>>(&json)
|
||||
.expect("EventJson::from_str always works")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use js_int::uint;
|
||||
use ruma::{
|
||||
events::push_rules::{ConditionalPushRule, PatternedPushRule, PushCondition, Ruleset},
|
||||
identifiers::UserId,
|
||||
push::{Action, Tweak},
|
||||
push::{
|
||||
Action, ConditionalPushRule, PatternedPushRule, PushCondition, RoomMemberCountIs, Ruleset,
|
||||
Tweak,
|
||||
},
|
||||
};
|
||||
|
||||
pub fn default_pushrules(user_id: &UserId) -> Ruleset {
|
||||
|
@ -174,7 +177,9 @@ pub fn encrypted_room_one_to_one_rule() -> ConditionalPushRule {
|
|||
enabled: true,
|
||||
rule_id: ".m.rule.encrypted_room_one_to_one".to_owned(),
|
||||
conditions: vec![
|
||||
PushCondition::RoomMemberCount { is: "2".to_owned() },
|
||||
PushCondition::RoomMemberCount {
|
||||
is: RoomMemberCountIs::from(uint!(2)..),
|
||||
},
|
||||
PushCondition::EventMatch {
|
||||
key: "type".to_owned(),
|
||||
pattern: "m.room.encrypted".to_owned(),
|
||||
|
@ -194,7 +199,9 @@ pub fn room_one_to_one_rule() -> ConditionalPushRule {
|
|||
enabled: true,
|
||||
rule_id: ".m.rule.room_one_to_one".to_owned(),
|
||||
conditions: vec![
|
||||
PushCondition::RoomMemberCount { is: "2".to_owned() },
|
||||
PushCondition::RoomMemberCount {
|
||||
is: RoomMemberCountIs::from(uint!(2)..),
|
||||
},
|
||||
PushCondition::EventMatch {
|
||||
key: "type".to_owned(),
|
||||
pattern: "m.room.message".to_owned(),
|
||||
|
|
Loading…
Reference in New Issue