Upgrade ruma
This commit is contained in:
parent
050e90db4f
commit
b7d465fabe
13
Cargo.toml
13
Cargo.toml
@ -19,16 +19,13 @@ maplit = "1.0.2"
|
||||
thiserror = "1.0.22"
|
||||
log = "0.4.11"
|
||||
|
||||
[features]
|
||||
unstable-pre-spec = ["ruma/unstable-pre-spec"]
|
||||
|
||||
[dependencies.ruma]
|
||||
git = "https://github.com/ruma/ruma"
|
||||
#branch = "server-pdu"
|
||||
#path = "../ruma/ruma"
|
||||
rev = "f196f5b6f164973d6b343af31ab4e0457f743675"
|
||||
features = ["client-api", "federation-api", "appservice-api", "unstable-pre-spec", "unstable-synapse-quirks"]
|
||||
|
||||
[features]
|
||||
default = ["unstable-pre-spec"]
|
||||
unstable-pre-spec = ["ruma/unstable-pre-spec"]
|
||||
rev = "d883debe072086efffd4255dcca0a1a0d6fcd9ce"
|
||||
features = ["events", "signatures"]
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3.3"
|
||||
|
@ -16,7 +16,7 @@ use ruma::{
|
||||
},
|
||||
EventType,
|
||||
},
|
||||
identifiers::{EventId, RoomId, RoomVersionId, UserId},
|
||||
EventId, RoomId, RoomVersionId, UserId,
|
||||
};
|
||||
use serde_json::{json, Value as JsonValue};
|
||||
use state_res::{Error, Event, Result, StateMap, StateResolution, StateStore};
|
||||
@ -498,7 +498,7 @@ pub mod event {
|
||||
},
|
||||
serde::CanonicalJsonValue,
|
||||
signatures::reference_hash,
|
||||
EventId, RoomId, RoomVersionId, ServerName, UInt, UserId,
|
||||
EventId, RoomId, RoomVersionId, ServerName, ServerSigningKeyId, UInt, UserId,
|
||||
};
|
||||
use serde::{de, ser, Deserialize, Serialize};
|
||||
use serde_json::{value::RawValue as RawJsonValue, Value as JsonValue};
|
||||
@ -546,9 +546,7 @@ pub mod event {
|
||||
fn hashes(&self) -> &EventHash {
|
||||
self.hashes()
|
||||
}
|
||||
fn signatures(
|
||||
&self,
|
||||
) -> BTreeMap<Box<ServerName>, BTreeMap<ruma::ServerSigningKeyId, String>> {
|
||||
fn signatures(&self) -> BTreeMap<Box<ServerName>, BTreeMap<ServerSigningKeyId, String>> {
|
||||
self.signatures()
|
||||
}
|
||||
fn unsigned(&self) -> &BTreeMap<String, JsonValue> {
|
||||
@ -675,9 +673,8 @@ pub mod event {
|
||||
| EventType::RoomJoinRules
|
||||
| EventType::RoomCreate => event.state_key == Some("".into()),
|
||||
EventType::RoomMember => {
|
||||
// TODO fix clone
|
||||
if let Ok(content) =
|
||||
// TODO fix clone
|
||||
|
||||
serde_json::from_value::<MemberEventContent>(event.content.clone())
|
||||
{
|
||||
if [MembershipState::Leave, MembershipState::Ban]
|
||||
@ -817,7 +814,7 @@ pub mod event {
|
||||
|
||||
pub fn signatures(
|
||||
&self,
|
||||
) -> BTreeMap<Box<ServerName>, BTreeMap<ruma::ServerSigningKeyId, String>> {
|
||||
) -> BTreeMap<Box<ServerName>, BTreeMap<ServerSigningKeyId, String>> {
|
||||
match self {
|
||||
Self::Full(_, ev) => match ev {
|
||||
Pdu::RoomV1Pdu(_) => maplit::btreemap! {},
|
||||
|
@ -11,7 +11,7 @@ use ruma::{
|
||||
},
|
||||
EventType,
|
||||
},
|
||||
identifiers::{RoomVersionId, UserId},
|
||||
RoomVersionId, UserId,
|
||||
};
|
||||
|
||||
use crate::{Error, Event, Result, StateMap};
|
||||
@ -762,7 +762,7 @@ pub fn get_send_level<E: Event>(
|
||||
})
|
||||
.ok()
|
||||
})
|
||||
.map(|int| i64::from(int))
|
||||
.map(i64::from)
|
||||
.unwrap_or_else(|| if state_key.is_some() { 50 } else { 0 })
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use maplit::btreeset;
|
||||
use ruma::{
|
||||
events::EventType,
|
||||
identifiers::{EventId, RoomId, RoomVersionId},
|
||||
};
|
||||
use ruma::{events::EventType, EventId, RoomId, RoomVersionId};
|
||||
|
||||
mod error;
|
||||
pub mod event_auth;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ruma::identifiers::RoomVersionId;
|
||||
use ruma::RoomVersionId;
|
||||
|
||||
pub enum RoomDisposition {
|
||||
/// A room version that has a stable specification.
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{collections::BTreeSet, sync::Arc};
|
||||
|
||||
use ruma::identifiers::{EventId, RoomId};
|
||||
use ruma::{EventId, RoomId};
|
||||
|
||||
use crate::{Event, Result};
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma::{
|
||||
events::EventType,
|
||||
identifiers::{EventId, RoomVersionId},
|
||||
};
|
||||
use ruma::{events::EventType, EventId, RoomVersionId};
|
||||
use state_res::{is_power_event, StateMap};
|
||||
|
||||
mod utils;
|
||||
|
@ -2,10 +2,7 @@
|
||||
|
||||
use std::{collections::BTreeMap, sync::Arc};
|
||||
|
||||
use ruma::{
|
||||
events::EventType,
|
||||
identifiers::{EventId, RoomVersionId},
|
||||
};
|
||||
use ruma::{events::EventType, EventId, RoomVersionId};
|
||||
use serde_json::json;
|
||||
use state_res::{EventMap, StateMap, StateResolution, StateStore};
|
||||
|
||||
|
@ -3,7 +3,7 @@ use std::{sync::Arc, time::UNIX_EPOCH};
|
||||
use maplit::btreemap;
|
||||
use ruma::{
|
||||
events::{room::join_rules::JoinRule, EventType},
|
||||
identifiers::{EventId, RoomVersionId},
|
||||
EventId, RoomVersionId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use state_res::{StateMap, StateResolution, StateStore};
|
||||
|
@ -15,7 +15,7 @@ use ruma::{
|
||||
},
|
||||
EventType,
|
||||
},
|
||||
identifiers::{EventId, RoomId, RoomVersionId, UserId},
|
||||
EventId, RoomId, RoomVersionId, UserId,
|
||||
};
|
||||
use serde_json::{json, Value as JsonValue};
|
||||
use state_res::{Error, Event, Result, StateMap, StateResolution, StateStore};
|
||||
@ -706,8 +706,8 @@ pub mod event {
|
||||
| EventType::RoomJoinRules
|
||||
| EventType::RoomCreate => event.state_key == Some("".into()),
|
||||
EventType::RoomMember => {
|
||||
// TODO fix clone
|
||||
if let Ok(content) =
|
||||
// TODO fix clone
|
||||
serde_json::from_value::<MemberEventContent>(event.content.clone())
|
||||
{
|
||||
if [MembershipState::Leave, MembershipState::Ban]
|
||||
@ -921,6 +921,7 @@ pub mod event {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(feature = "unstable-pre-spec"), ignore)]
|
||||
fn serialize_pdu() {
|
||||
let non_canonical_json = r#"{"auth_events": ["$FEKmyWTamMqoL3zkEC3mVPg3qkcXcUShxxaq5BltsCE", "$Oc8MYrZ3-eM4yBbhlj8YkYYluF9KHFDKU5uDpO-Ewcc", "$3ImCSXY6bbWbZ5S2N6BMplHHlP7RkxWZCM9fMbdM2NY", "$8Lfs0rVCE9bHQrUztEF9kbsrT4zASnPEtpImZN4L2n8"], "content": {"membership": "join"}, "depth": 135, "hashes": {"sha256": "Q7OehFJaB32W3NINZKesQZH7+ba7xZVFuyCtuWQ2emk"}, "origin": "pc.koesters.xyz:59003", "origin_server_ts": 1599901756522, "prev_events": ["$Oc8MYrZ3-eM4yBbhlj8YkYYluF9KHFDKU5uDpO-Ewcc"], "prev_state": [], "room_id": "!eGNyCFvnKcpsnIZiEV:koesters.xyz", "sender": "@timo:pc.koesters.xyz:59003", "state_key": "@timo:pc.koesters.xyz:59003", "type": "m.room.member", "signatures": {"koesters.xyz": {"ed25519:a_wwQy": "bb8T5haywaEXKNxUUjeNBfjYi/Qe32R/dGliduIs3Ct913WGzXYLjWh7xHqapie7viHPzkDw/KYJacpAYKvMBA"}, "pc.koesters.xyz:59003": {"ed25519:key1": "/B3tpaMZKoLNITrup4fbFhbIMWixxEKM49nS4MiKOFfyJjDGuC5nWsurw0m2eYzrffhkF5qQQ8+RlFvkqwqkBw"}}, "unsigned": {"age": 30, "replaces_state": "$Oc8MYrZ3-eM4yBbhlj8YkYYluF9KHFDKU5uDpO-Ewcc", "prev_content": {"membership": "join"}, "prev_sender": "@timo:pc.koesters.xyz:59003"}}"#;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user