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"]
sled_state_store = ["sled", "pbkdf2", "hmac", "sha2", "rand", "chacha20poly1305"]
sled_cryptostore = ["matrix-sdk-crypto/sled_cryptostore"]
markdown = ["matrix-sdk-common/markdown"]
markdown = ["ruma/markdown"]
docs = ["encryption", "sled_cryptostore"]
[dependencies]
dashmap = "4.0.2"
lru = "0.6.5"
ruma = { version = "0.1.2", features = ["client-api-c", "unstable-pre-spec"] }
serde = { version = "1.0.122", features = ["rc"] }
serde_json = "1.0.61"
tracing = "0.1.22"

View File

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

View File

@ -22,40 +22,42 @@ use std::{
sync::Arc,
};
#[cfg(feature = "encryption")]
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::{
AmbiguityChanges, JoinedRoom, LeftRoom, MemberEvent, MembersResponse, Rooms,
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::{
room::member::{MemberEventContent, MembershipState},
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent,
AnySyncEphemeralRoomEvent, AnySyncRoomEvent, AnySyncStateEvent, EventContent, EventType,
StateEvent,
},
identifiers::{RoomId, UserId},
instant::Instant,
locks::RwLock,
push::{Action, PushConditionRoomCtx, Ruleset},
MilliSecondsSinceUnixEpoch, Raw, UInt,
};
#[cfg(feature = "encryption")]
use matrix_sdk_crypto::{
store::{CryptoStore, CryptoStoreError},
Device, EncryptionSettings, IncomingResponse, MegolmError, OlmError, OlmMachine,
OutgoingRequest, Sas, ToDeviceRequest, UserDevices,
serde::Raw,
MilliSecondsSinceUnixEpoch, RoomId, UInt, UserId,
};
use tracing::{info, warn};
use zeroize::Zeroizing;
@ -1233,7 +1235,7 @@ impl BaseClient {
/// ```
/// # use std::convert::TryFrom;
/// # use matrix_sdk_base::BaseClient;
/// # use matrix_sdk_common::identifiers::UserId;
/// # use ruma::UserId;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let client = BaseClient::new().unwrap();
@ -1290,7 +1292,7 @@ impl BaseClient {
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk_base::BaseClient;
/// # use matrix_sdk_common::identifiers::UserId;
/// # use ruma::UserId;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").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).
use matrix_sdk_common::{
api::r0::media::get_content_thumbnail::Method,
use ruma::{
api::client::r0::media::get_content_thumbnail::Method,
events::{
room::{
message::{
@ -12,8 +12,7 @@ use matrix_sdk_common::{
},
sticker::StickerEventContent,
},
identifiers::MxcUri,
UInt,
MxcUri, UInt,
};
const UNIQUE_SEPARATOR: &str = "_";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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