base: Depend on ruma directly

master
Jonas Platte 2021-06-07 16:25:48 +02:00
parent 74d0ac7c77
commit c964589049
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
12 changed files with 64 additions and 67 deletions

View File

@ -19,13 +19,14 @@ default = []
encryption = ["matrix-sdk-crypto"] encryption = ["matrix-sdk-crypto"]
sled_state_store = ["sled", "pbkdf2", "hmac", "sha2", "rand", "chacha20poly1305"] sled_state_store = ["sled", "pbkdf2", "hmac", "sha2", "rand", "chacha20poly1305"]
sled_cryptostore = ["matrix-sdk-crypto/sled_cryptostore"] sled_cryptostore = ["matrix-sdk-crypto/sled_cryptostore"]
markdown = ["matrix-sdk-common/markdown"] markdown = ["ruma/markdown"]
docs = ["encryption", "sled_cryptostore"] docs = ["encryption", "sled_cryptostore"]
[dependencies] [dependencies]
dashmap = "4.0.2" dashmap = "4.0.2"
lru = "0.6.5" lru = "0.6.5"
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"] }
serde = { version = "1.0.122", features = ["rc"] } serde = { version = "1.0.122", features = ["rc"] }
serde_json = "1.0.61" serde_json = "1.0.61"
tracing = "0.1.22" tracing = "0.1.22"

View File

@ -5,10 +5,10 @@ use atty::Stream;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use clap::{App as Argparse, AppSettings as ArgParseSettings, Arg, ArgMatches, SubCommand}; use clap::{App as Argparse, AppSettings as ArgParseSettings, Arg, ArgMatches, SubCommand};
use futures::executor::block_on; use futures::executor::block_on;
use matrix_sdk_base::{ use matrix_sdk_base::{RoomInfo, Store};
use ruma::{
events::EventType, events::EventType,
identifiers::{RoomId, UserId}, identifiers::{RoomId, UserId},
RoomInfo, Store,
}; };
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use rustyline::{ use rustyline::{

View File

@ -22,40 +22,42 @@ use std::{
sync::Arc, sync::Arc,
}; };
#[cfg(feature = "encryption")]
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::keys::claim_keys::Request as KeysClaimRequest,
events::{
room::{encrypted::EncryptedEventContent, history_visibility::HistoryVisibility},
AnyMessageEventContent, AnySyncMessageEvent,
},
identifiers::DeviceId,
locks::Mutex,
uuid::Uuid,
};
use matrix_sdk_common::{
api::r0::{self as api, push::get_notifications::Notification},
deserialized_responses::{ deserialized_responses::{
AmbiguityChanges, JoinedRoom, LeftRoom, MemberEvent, MembersResponse, Rooms, AmbiguityChanges, JoinedRoom, LeftRoom, MemberEvent, MembersResponse, Rooms,
StrippedMemberEvent, SyncResponse, SyncRoomEvent, Timeline, StrippedMemberEvent, SyncResponse, SyncRoomEvent, Timeline,
}, },
instant::Instant,
locks::RwLock,
};
#[cfg(feature = "encryption")]
use matrix_sdk_common::{locks::Mutex, uuid::Uuid};
#[cfg(feature = "encryption")]
use matrix_sdk_crypto::{
store::{CryptoStore, CryptoStoreError},
Device, EncryptionSettings, IncomingResponse, MegolmError, OlmError, OlmMachine,
OutgoingRequest, Sas, ToDeviceRequest, UserDevices,
};
#[cfg(feature = "encryption")]
use ruma::{
api::client::r0::keys::claim_keys::Request as KeysClaimRequest,
events::{
room::{encrypted::EncryptedEventContent, history_visibility::HistoryVisibility},
AnyMessageEventContent, AnySyncMessageEvent,
},
DeviceId,
};
use ruma::{
api::client::r0::{self as api, push::get_notifications::Notification},
events::{ events::{
room::member::{MemberEventContent, MembershipState}, room::member::{MemberEventContent, MembershipState},
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent,
AnySyncEphemeralRoomEvent, AnySyncRoomEvent, AnySyncStateEvent, EventContent, EventType, AnySyncEphemeralRoomEvent, AnySyncRoomEvent, AnySyncStateEvent, EventContent, EventType,
StateEvent, StateEvent,
}, },
identifiers::{RoomId, UserId},
instant::Instant,
locks::RwLock,
push::{Action, PushConditionRoomCtx, Ruleset}, push::{Action, PushConditionRoomCtx, Ruleset},
MilliSecondsSinceUnixEpoch, Raw, UInt, serde::Raw,
}; MilliSecondsSinceUnixEpoch, RoomId, UInt, UserId,
#[cfg(feature = "encryption")]
use matrix_sdk_crypto::{
store::{CryptoStore, CryptoStoreError},
Device, EncryptionSettings, IncomingResponse, MegolmError, OlmError, OlmMachine,
OutgoingRequest, Sas, ToDeviceRequest, UserDevices,
}; };
use tracing::{info, warn}; use tracing::{info, warn};
use zeroize::Zeroizing; use zeroize::Zeroizing;
@ -1233,7 +1235,7 @@ impl BaseClient {
/// ``` /// ```
/// # use std::convert::TryFrom; /// # use std::convert::TryFrom;
/// # use matrix_sdk_base::BaseClient; /// # use matrix_sdk_base::BaseClient;
/// # use matrix_sdk_common::identifiers::UserId; /// # use ruma::UserId;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap(); /// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let client = BaseClient::new().unwrap(); /// # let client = BaseClient::new().unwrap();
@ -1290,7 +1292,7 @@ impl BaseClient {
/// ```no_run /// ```no_run
/// # use std::convert::TryFrom; /// # use std::convert::TryFrom;
/// # use matrix_sdk_base::BaseClient; /// # use matrix_sdk_base::BaseClient;
/// # use matrix_sdk_common::identifiers::UserId; /// # use ruma::UserId;
/// # use futures::executor::block_on; /// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap(); /// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let client = BaseClient::new().unwrap(); /// # let client = BaseClient::new().unwrap();

View File

@ -1,7 +1,7 @@
//! Common types for [media content](https://matrix.org/docs/spec/client_server/r0.6.1#id66). //! Common types for [media content](https://matrix.org/docs/spec/client_server/r0.6.1#id66).
use matrix_sdk_common::{ use ruma::{
api::r0::media::get_content_thumbnail::Method, api::client::r0::media::get_content_thumbnail::Method,
events::{ events::{
room::{ room::{
message::{ message::{
@ -12,8 +12,7 @@ use matrix_sdk_common::{
}, },
sticker::StickerEventContent, sticker::StickerEventContent,
}, },
identifiers::MxcUri, MxcUri, UInt,
UInt,
}; };
const UNIQUE_SEPARATOR: &str = "_"; const UNIQUE_SEPARATOR: &str = "_";

View File

@ -14,13 +14,13 @@
use std::sync::Arc; use std::sync::Arc;
use matrix_sdk_common::{ use ruma::{
events::{ events::{
presence::PresenceEvent, presence::PresenceEvent,
room::{member::MemberEventContent, power_levels::PowerLevelsEventContent}, room::{member::MemberEventContent, power_levels::PowerLevelsEventContent},
SyncStateEvent, SyncStateEvent,
}, },
identifiers::{MxcUri, UserId}, MxcUri, UserId,
}; };
use crate::deserialized_responses::MemberEvent; use crate::deserialized_responses::MemberEvent;

View File

@ -3,7 +3,9 @@ mod normal;
use std::cmp::max; use std::cmp::max;
use matrix_sdk_common::{ pub use members::RoomMember;
pub use normal::{Room, RoomInfo, RoomType};
use ruma::{
events::{ events::{
room::{ room::{
create::CreateEventContent, encryption::EncryptionEventContent, create::CreateEventContent, encryption::EncryptionEventContent,
@ -12,10 +14,8 @@ use matrix_sdk_common::{
}, },
AnyStateEventContent, AnyStateEventContent,
}, },
identifiers::{MxcUri, RoomAliasId, UserId}, MxcUri, RoomAliasId, UserId,
}; };
pub use members::RoomMember;
pub use normal::{Room, RoomInfo, RoomType};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A base room info struct that is the backbone of normal as well as stripped /// A base room info struct that is the backbone of normal as well as stripped

View File

@ -21,8 +21,8 @@ use futures::{
future, future,
stream::{self, StreamExt}, stream::{self, StreamExt},
}; };
use matrix_sdk_common::{ use ruma::{
api::r0::sync::sync_events::RoomSummary as RumaSummary, api::client::r0::sync::sync_events::RoomSummary as RumaSummary,
events::{ events::{
receipt::Receipt, receipt::Receipt,
room::{ room::{
@ -33,8 +33,8 @@ use matrix_sdk_common::{
tag::Tags, tag::Tags,
AnyRoomAccountDataEvent, AnyStateEventContent, AnySyncStateEvent, EventType, AnyRoomAccountDataEvent, AnyStateEventContent, AnySyncStateEvent, EventType,
}, },
identifiers::{EventId, MxcUri, RoomAliasId, RoomId, UserId},
receipt::ReceiptType, receipt::ReceiptType,
EventId, MxcUri, RoomAliasId, RoomId, UserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::info; use tracing::info;

View File

@ -15,7 +15,7 @@
//! User sessions. //! User sessions.
use matrix_sdk_common::identifiers::{DeviceId, UserId}; use ruma::{DeviceId, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A user session, containing an access token and information about the /// A user session, containing an access token and information about the

View File

@ -14,11 +14,8 @@
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use matrix_sdk_common::{ use matrix_sdk_common::deserialized_responses::{AmbiguityChange, MemberEvent};
deserialized_responses::{AmbiguityChange, MemberEvent}, use ruma::{events::room::member::MembershipState, EventId, RoomId, UserId};
events::room::member::MembershipState,
identifiers::{EventId, RoomId, UserId},
};
use tracing::trace; use tracing::trace;
use super::{Result, StateChanges}; use super::{Result, StateChanges};

View File

@ -19,8 +19,8 @@ use std::{
use dashmap::{DashMap, DashSet}; use dashmap::{DashMap, DashSet};
use lru::LruCache; use lru::LruCache;
use matrix_sdk_common::{ use matrix_sdk_common::{async_trait, instant::Instant, locks::Mutex};
async_trait, use ruma::{
events::{ events::{
presence::PresenceEvent, presence::PresenceEvent,
receipt::Receipt, receipt::Receipt,
@ -29,10 +29,8 @@ use matrix_sdk_common::{
AnySyncStateEvent, EventType, AnySyncStateEvent, EventType,
}, },
identifiers::{EventId, MxcUri, RoomId, UserId}, identifiers::{EventId, MxcUri, RoomId, UserId},
instant::Instant,
locks::Mutex,
receipt::ReceiptType, receipt::ReceiptType,
Raw, serde::Raw,
}; };
use tracing::info; use tracing::info;
@ -563,7 +561,7 @@ impl StateStore for MemoryStore {
#[cfg(not(feature = "sled_state_store"))] #[cfg(not(feature = "sled_state_store"))]
mod test { mod test {
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::media::get_content_thumbnail::Method, api::client::r0::media::get_content_thumbnail::Method,
identifiers::{event_id, mxc_uri, room_id, user_id, UserId}, identifiers::{event_id, mxc_uri, room_id, user_id, UserId},
receipt::ReceiptType, receipt::ReceiptType,
uint, uint,

View File

@ -21,9 +21,9 @@ use std::{
}; };
use dashmap::DashMap; use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{async_trait, locks::RwLock, AsyncTraitDeps};
api::r0::push::get_notifications::Notification, use ruma::{
async_trait, api::client::r0::push::get_notifications::Notification,
events::{ events::{
presence::PresenceEvent, presence::PresenceEvent,
receipt::{Receipt, ReceiptEventContent}, receipt::{Receipt, ReceiptEventContent},
@ -31,10 +31,9 @@ use matrix_sdk_common::{
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent,
AnySyncStateEvent, EventContent, EventType, AnySyncStateEvent, EventContent, EventType,
}, },
identifiers::{EventId, MxcUri, RoomId, UserId},
locks::RwLock,
receipt::ReceiptType, receipt::ReceiptType,
AsyncTraitDeps, Raw, serde::Raw,
EventId, MxcUri, RoomId, UserId,
}; };
#[cfg(feature = "sled_state_store")] #[cfg(feature = "sled_state_store")]
use sled::Db; use sled::Db;
@ -69,7 +68,7 @@ pub enum StoreError {
/// An error happened while deserializing a Matrix identifier, e.g. an user /// An error happened while deserializing a Matrix identifier, e.g. an user
/// id. /// id.
#[error(transparent)] #[error(transparent)]
Identifier(#[from] matrix_sdk_common::identifiers::Error), Identifier(#[from] ruma::identifiers::Error),
/// The store is locked with a passphrase and an incorrect passphrase was /// The store is locked with a passphrase and an incorrect passphrase was
/// given. /// given.
#[error("The store failed to be unlocked")] #[error("The store failed to be unlocked")]

View File

@ -26,17 +26,17 @@ use futures::{
stream::{self, Stream}, stream::{self, Stream},
TryStreamExt, TryStreamExt,
}; };
use matrix_sdk_common::{ use matrix_sdk_common::async_trait;
async_trait, use ruma::{
events::{ events::{
presence::PresenceEvent, presence::PresenceEvent,
receipt::Receipt, receipt::Receipt,
room::member::{MemberEventContent, MembershipState}, room::member::{MemberEventContent, MembershipState},
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnySyncStateEvent, EventType, AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnySyncStateEvent, EventType,
}, },
identifiers::{EventId, MxcUri, RoomId, UserId},
receipt::ReceiptType, receipt::ReceiptType,
Raw, serde::Raw,
EventId, MxcUri, RoomId, UserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sled::{ use sled::{
@ -899,8 +899,9 @@ impl StateStore for SledStore {
mod test { mod test {
use std::convert::TryFrom; use std::convert::TryFrom;
use matrix_sdk_common::{ use matrix_sdk_test::async_test;
api::r0::media::get_content_thumbnail::Method, use ruma::{
api::client::r0::media::get_content_thumbnail::Method,
events::{ events::{
room::{ room::{
member::{MemberEventContent, MembershipState}, member::{MemberEventContent, MembershipState},
@ -910,9 +911,9 @@ mod test {
}, },
identifiers::{event_id, mxc_uri, room_id, user_id, EventId, UserId}, identifiers::{event_id, mxc_uri, room_id, user_id, EventId, UserId},
receipt::ReceiptType, receipt::ReceiptType,
uint, MilliSecondsSinceUnixEpoch, Raw, serde::Raw,
uint, MilliSecondsSinceUnixEpoch,
}; };
use matrix_sdk_test::async_test;
use serde_json::json; use serde_json::json;
use super::{SledStore, StateChanges}; use super::{SledStore, StateChanges};