Bump ruma
This commit is contained in:
parent
275c6b447d
commit
6b131202b9
68 changed files with 446 additions and 347 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::{RoomAliasId, RoomId};
|
||||
use ruma::{OwnedRoomAliasId, OwnedRoomId, RoomAliasId, RoomId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
/// Creates or updates the alias to the given room id.
|
||||
|
@ -9,11 +9,11 @@ pub trait Data: Send + Sync {
|
|||
fn remove_alias(&self, alias: &RoomAliasId) -> Result<()>;
|
||||
|
||||
/// Looks up the roomid for the given alias.
|
||||
fn resolve_local_alias(&self, alias: &RoomAliasId) -> Result<Option<Box<RoomId>>>;
|
||||
fn resolve_local_alias(&self, alias: &RoomAliasId) -> Result<Option<OwnedRoomId>>;
|
||||
|
||||
/// Returns all local aliases that point to the given room
|
||||
fn local_aliases_for_room<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<RoomAliasId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a>;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ mod data;
|
|||
pub use data::Data;
|
||||
|
||||
use crate::Result;
|
||||
use ruma::{RoomAliasId, RoomId};
|
||||
use ruma::{OwnedRoomAliasId, OwnedRoomId, RoomAliasId, RoomId};
|
||||
|
||||
pub struct Service {
|
||||
pub db: &'static dyn Data,
|
||||
|
@ -21,7 +21,7 @@ impl Service {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn resolve_local_alias(&self, alias: &RoomAliasId) -> Result<Option<Box<RoomId>>> {
|
||||
pub fn resolve_local_alias(&self, alias: &RoomAliasId) -> Result<Option<OwnedRoomId>> {
|
||||
self.db.resolve_local_alias(alias)
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ impl Service {
|
|||
pub fn local_aliases_for_room<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<RoomAliasId>>> + 'a> {
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a> {
|
||||
self.db.local_aliases_for_room(room_id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::RoomId;
|
||||
use ruma::{OwnedRoomId, RoomId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
/// Adds the room to the public room directory
|
||||
|
@ -12,5 +12,5 @@ pub trait Data: Send + Sync {
|
|||
fn is_public_room(&self, room_id: &RoomId) -> Result<bool>;
|
||||
|
||||
/// Returns the unsorted public room directory
|
||||
fn public_rooms<'a>(&'a self) -> Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a>;
|
||||
fn public_rooms<'a>(&'a self) -> Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a>;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod data;
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::RoomId;
|
||||
use ruma::{OwnedRoomId, RoomId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
@ -26,7 +26,7 @@ impl Service {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn public_rooms(&self) -> impl Iterator<Item = Result<Box<RoomId>>> + '_ {
|
||||
pub fn public_rooms(&self) -> impl Iterator<Item = Result<OwnedRoomId>> + '_ {
|
||||
self.db.public_rooms()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::Result;
|
||||
use ruma::{events::presence::PresenceEvent, RoomId, UserId};
|
||||
use ruma::{events::presence::PresenceEvent, OwnedUserId, RoomId, UserId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
/// Adds a presence event which will be saved until a new event replaces it.
|
||||
|
@ -34,5 +34,5 @@ pub trait Data: Send + Sync {
|
|||
&self,
|
||||
room_id: &RoomId,
|
||||
since: u64,
|
||||
) -> Result<HashMap<Box<UserId>, PresenceEvent>>;
|
||||
) -> Result<HashMap<OwnedUserId, PresenceEvent>>;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ mod data;
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::{events::presence::PresenceEvent, RoomId, UserId};
|
||||
use ruma::{events::presence::PresenceEvent, OwnedUserId, RoomId, UserId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
@ -116,7 +116,7 @@ impl Service {
|
|||
&self,
|
||||
room_id: &RoomId,
|
||||
since: u64,
|
||||
) -> Result<HashMap<Box<UserId>, PresenceEvent>> {
|
||||
) -> Result<HashMap<OwnedUserId, PresenceEvent>> {
|
||||
self.db.presence_since(room_id, since)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::{events::receipt::ReceiptEvent, serde::Raw, RoomId, UserId};
|
||||
use ruma::{events::receipt::ReceiptEvent, serde::Raw, OwnedUserId, RoomId, UserId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
/// Replaces the previous read receipt.
|
||||
|
@ -18,7 +18,7 @@ pub trait Data: Send + Sync {
|
|||
) -> Box<
|
||||
dyn Iterator<
|
||||
Item = Result<(
|
||||
Box<UserId>,
|
||||
OwnedUserId,
|
||||
u64,
|
||||
Raw<ruma::events::AnySyncEphemeralRoomEvent>,
|
||||
)>,
|
||||
|
|
|
@ -3,7 +3,7 @@ mod data;
|
|||
pub use data::Data;
|
||||
|
||||
use crate::Result;
|
||||
use ruma::{events::receipt::ReceiptEvent, serde::Raw, RoomId, UserId};
|
||||
use ruma::{events::receipt::ReceiptEvent, serde::Raw, OwnedUserId, RoomId, UserId};
|
||||
|
||||
pub struct Service {
|
||||
pub db: &'static dyn Data,
|
||||
|
@ -28,7 +28,7 @@ impl Service {
|
|||
since: u64,
|
||||
) -> impl Iterator<
|
||||
Item = Result<(
|
||||
Box<UserId>,
|
||||
OwnedUserId,
|
||||
u64,
|
||||
Raw<ruma::events::AnySyncEphemeralRoomEvent>,
|
||||
)>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::{RoomId, UserId};
|
||||
use ruma::{OwnedUserId, RoomId, UserId};
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
|
@ -14,5 +14,5 @@ pub trait Data: Send + Sync {
|
|||
fn last_typing_update(&self, room_id: &RoomId) -> Result<u64>;
|
||||
|
||||
/// Returns all user ids currently typing.
|
||||
fn typings_all(&self, room_id: &RoomId) -> Result<HashSet<Box<UserId>>>;
|
||||
fn typings_all(&self, room_id: &RoomId) -> Result<HashSet<OwnedUserId>>;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ type AsyncRecursiveType<'a, T> = Pin<Box<dyn Future<Output = T> + 'a + Send>>;
|
|||
|
||||
use ruma::{
|
||||
api::federation::discovery::{get_remote_server_keys, get_server_keys},
|
||||
signatures::CanonicalJsonObject,
|
||||
CanonicalJsonObject, CanonicalJsonValue, OwnedServerName, OwnedServerSigningKeyId,
|
||||
RoomVersionId,
|
||||
};
|
||||
use std::{
|
||||
|
@ -30,7 +30,6 @@ use ruma::{
|
|||
},
|
||||
int,
|
||||
serde::Base64,
|
||||
signatures::CanonicalJsonValue,
|
||||
state_res::{self, RoomVersion, StateMap},
|
||||
uint, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId,
|
||||
};
|
||||
|
@ -300,7 +299,7 @@ impl Service {
|
|||
Ok(ruma::signatures::Verified::Signatures) => {
|
||||
// Redact
|
||||
warn!("Calculated hash does not match: {}", event_id);
|
||||
match ruma::signatures::redact(&value, room_version_id) {
|
||||
match ruma::canonical_json::redact(&value, room_version_id) {
|
||||
Ok(obj) => obj,
|
||||
Err(_) => {
|
||||
return Err(Error::BadRequest(
|
||||
|
@ -974,7 +973,11 @@ impl Service {
|
|||
.rooms
|
||||
.state_compressor
|
||||
.save_state(room_id, new_room_state)?;
|
||||
services().rooms.state.force_state(room_id, sstatehash, new, removed, &state_lock).await?;
|
||||
services()
|
||||
.rooms
|
||||
.state
|
||||
.force_state(room_id, sstatehash, new, removed, &state_lock)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1325,7 @@ impl Service {
|
|||
fn get_server_keys_from_cache(
|
||||
&self,
|
||||
pdu: &RawJsonValue,
|
||||
servers: &mut BTreeMap<Box<ServerName>, BTreeMap<Box<ServerSigningKeyId>, QueryCriteria>>,
|
||||
servers: &mut BTreeMap<OwnedServerName, BTreeMap<OwnedServerSigningKeyId, QueryCriteria>>,
|
||||
room_version: &RoomVersionId,
|
||||
pub_key_map: &mut RwLockWriteGuard<'_, BTreeMap<String, BTreeMap<String, Base64>>>,
|
||||
) -> Result<()> {
|
||||
|
@ -1414,8 +1417,8 @@ impl Service {
|
|||
pub_key_map: &RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
|
||||
) -> Result<()> {
|
||||
let mut servers: BTreeMap<
|
||||
Box<ServerName>,
|
||||
BTreeMap<Box<ServerSigningKeyId>, QueryCriteria>,
|
||||
OwnedServerName,
|
||||
BTreeMap<OwnedServerSigningKeyId, QueryCriteria>,
|
||||
> = BTreeMap::new();
|
||||
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
};
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::{DeviceId, RoomId, UserId};
|
||||
use ruma::{DeviceId, OwnedDeviceId, OwnedRoomId, OwnedUserId, RoomId, UserId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub struct Service {
|
|||
pub db: &'static dyn Data,
|
||||
|
||||
pub lazy_load_waiting:
|
||||
Mutex<HashMap<(Box<UserId>, Box<DeviceId>, Box<RoomId>, u64), HashSet<Box<UserId>>>>,
|
||||
Mutex<HashMap<(OwnedUserId, OwnedDeviceId, OwnedRoomId, u64), HashSet<OwnedUserId>>>,
|
||||
}
|
||||
|
||||
impl Service {
|
||||
|
@ -35,7 +35,7 @@ impl Service {
|
|||
user_id: &UserId,
|
||||
device_id: &DeviceId,
|
||||
room_id: &RoomId,
|
||||
lazy_load: HashSet<Box<UserId>>,
|
||||
lazy_load: HashSet<OwnedUserId>,
|
||||
count: u64,
|
||||
) {
|
||||
self.lazy_load_waiting.lock().unwrap().insert(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::Result;
|
||||
use ruma::RoomId;
|
||||
use ruma::{OwnedRoomId, RoomId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
fn exists(&self, room_id: &RoomId) -> Result<bool>;
|
||||
fn iter_ids<'a>(&'a self) -> Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a>;
|
||||
fn iter_ids<'a>(&'a self) -> Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a>;
|
||||
fn is_disabled(&self, room_id: &RoomId) -> Result<bool>;
|
||||
fn disable_room(&self, room_id: &RoomId, disabled: bool) -> Result<()>;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod data;
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::RoomId;
|
||||
use ruma::{OwnedRoomId, RoomId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
@ -16,7 +16,7 @@ impl Service {
|
|||
self.db.exists(room_id)
|
||||
}
|
||||
|
||||
pub fn iter_ids<'a>(&'a self) -> Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a> {
|
||||
pub fn iter_ids<'a>(&'a self) -> Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a> {
|
||||
self.db.iter_ids()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ruma::{signatures::CanonicalJsonObject, EventId};
|
||||
use ruma::{CanonicalJsonObject, EventId};
|
||||
|
||||
use crate::{PduEvent, Result};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod data;
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::{signatures::CanonicalJsonObject, EventId};
|
||||
use ruma::{CanonicalJsonObject, EventId};
|
||||
|
||||
use crate::{PduEvent, Result};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::{EventId, RoomId};
|
||||
use ruma::{EventId, OwnedEventId, RoomId};
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::MutexGuard;
|
||||
|
@ -26,7 +26,7 @@ pub trait Data: Send + Sync {
|
|||
fn set_forward_extremities<'a>(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
event_ids: Vec<Box<EventId>>,
|
||||
event_ids: Vec<OwnedEventId>,
|
||||
_mutex_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
|
||||
) -> Result<()>;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use ruma::{
|
|||
},
|
||||
serde::Raw,
|
||||
state_res::{self, StateMap},
|
||||
EventId, RoomId, RoomVersionId, UserId,
|
||||
EventId, OwnedEventId, RoomId, RoomVersionId, UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tokio::sync::MutexGuard;
|
||||
|
@ -346,7 +346,7 @@ impl Service {
|
|||
pub fn set_forward_extremities<'a>(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
event_ids: Vec<Box<EventId>>,
|
||||
event_ids: Vec<OwnedEventId>,
|
||||
state_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
|
||||
) -> Result<()> {
|
||||
self.db
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::Result;
|
|||
use ruma::{
|
||||
events::{AnyStrippedStateEvent, AnySyncStateEvent},
|
||||
serde::Raw,
|
||||
RoomId, ServerName, UserId,
|
||||
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
|
||||
};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
|
@ -20,7 +20,7 @@ pub trait Data: Send + Sync {
|
|||
|
||||
fn update_joined_count(&self, room_id: &RoomId) -> Result<()>;
|
||||
|
||||
fn get_our_real_users(&self, room_id: &RoomId) -> Result<Arc<HashSet<Box<UserId>>>>;
|
||||
fn get_our_real_users(&self, room_id: &RoomId) -> Result<Arc<HashSet<OwnedUserId>>>;
|
||||
|
||||
fn appservice_in_room(
|
||||
&self,
|
||||
|
@ -35,7 +35,7 @@ pub trait Data: Send + Sync {
|
|||
fn room_servers<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<ServerName>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedServerName>> + 'a>;
|
||||
|
||||
fn server_in_room<'a>(&'a self, server: &ServerName, room_id: &RoomId) -> Result<bool>;
|
||||
|
||||
|
@ -43,13 +43,13 @@ pub trait Data: Send + Sync {
|
|||
fn server_rooms<'a>(
|
||||
&'a self,
|
||||
server: &ServerName,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a>;
|
||||
|
||||
/// Returns an iterator over all joined members of a room.
|
||||
fn room_members<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<UserId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + 'a>;
|
||||
|
||||
fn room_joined_count(&self, room_id: &RoomId) -> Result<Option<u64>>;
|
||||
|
||||
|
@ -59,13 +59,13 @@ pub trait Data: Send + Sync {
|
|||
fn room_useroncejoined<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<UserId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + 'a>;
|
||||
|
||||
/// Returns an iterator over all invited members of a room.
|
||||
fn room_members_invited<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<UserId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + 'a>;
|
||||
|
||||
fn get_invite_count(&self, room_id: &RoomId, user_id: &UserId) -> Result<Option<u64>>;
|
||||
|
||||
|
@ -75,13 +75,13 @@ pub trait Data: Send + Sync {
|
|||
fn rooms_joined<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a>;
|
||||
|
||||
/// Returns an iterator over all rooms a user was invited to.
|
||||
fn rooms_invited<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> Box<dyn Iterator<Item = Result<(Box<RoomId>, Vec<Raw<AnyStrippedStateEvent>>)>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, Vec<Raw<AnyStrippedStateEvent>>)>> + 'a>;
|
||||
|
||||
fn invite_state(
|
||||
&self,
|
||||
|
@ -99,7 +99,7 @@ pub trait Data: Send + Sync {
|
|||
fn rooms_left<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> Box<dyn Iterator<Item = Result<(Box<RoomId>, Vec<Raw<AnySyncStateEvent>>)>> + 'a>;
|
||||
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, Vec<Raw<AnySyncStateEvent>>)>> + 'a>;
|
||||
|
||||
fn once_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result<bool>;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use ruma::{
|
|||
RoomAccountDataEventType, StateEventType,
|
||||
},
|
||||
serde::Raw,
|
||||
RoomId, ServerName, UserId,
|
||||
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
|
||||
};
|
||||
|
||||
use crate::{services, Error, Result};
|
||||
|
@ -192,7 +192,7 @@ impl Service {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip(self, room_id))]
|
||||
pub fn get_our_real_users(&self, room_id: &RoomId) -> Result<Arc<HashSet<Box<UserId>>>> {
|
||||
pub fn get_our_real_users(&self, room_id: &RoomId) -> Result<Arc<HashSet<OwnedUserId>>> {
|
||||
self.db.get_our_real_users(room_id)
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ impl Service {
|
|||
pub fn room_servers<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> impl Iterator<Item = Result<Box<ServerName>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedServerName>> + 'a {
|
||||
self.db.room_servers(room_id)
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ impl Service {
|
|||
pub fn server_rooms<'a>(
|
||||
&'a self,
|
||||
server: &ServerName,
|
||||
) -> impl Iterator<Item = Result<Box<RoomId>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedRoomId>> + 'a {
|
||||
self.db.server_rooms(server)
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ impl Service {
|
|||
pub fn room_members<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> impl Iterator<Item = Result<Box<UserId>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedUserId>> + 'a {
|
||||
self.db.room_members(room_id)
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ impl Service {
|
|||
pub fn room_useroncejoined<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> impl Iterator<Item = Result<Box<UserId>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedUserId>> + 'a {
|
||||
self.db.room_useroncejoined(room_id)
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ impl Service {
|
|||
pub fn room_members_invited<'a>(
|
||||
&'a self,
|
||||
room_id: &RoomId,
|
||||
) -> impl Iterator<Item = Result<Box<UserId>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedUserId>> + 'a {
|
||||
self.db.room_members_invited(room_id)
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ impl Service {
|
|||
pub fn rooms_joined<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> impl Iterator<Item = Result<Box<RoomId>>> + 'a {
|
||||
) -> impl Iterator<Item = Result<OwnedRoomId>> + 'a {
|
||||
self.db.rooms_joined(user_id)
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ impl Service {
|
|||
pub fn rooms_invited<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> impl Iterator<Item = Result<(Box<RoomId>, Vec<Raw<AnyStrippedStateEvent>>)>> + 'a {
|
||||
) -> impl Iterator<Item = Result<(OwnedRoomId, Vec<Raw<AnyStrippedStateEvent>>)>> + 'a {
|
||||
self.db.rooms_invited(user_id)
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ impl Service {
|
|||
pub fn rooms_left<'a>(
|
||||
&'a self,
|
||||
user_id: &UserId,
|
||||
) -> impl Iterator<Item = Result<(Box<RoomId>, Vec<Raw<AnySyncStateEvent>>)>> + 'a {
|
||||
) -> impl Iterator<Item = Result<(OwnedRoomId, Vec<Raw<AnySyncStateEvent>>)>> + 'a {
|
||||
self.db.rooms_left(user_id)
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,11 @@ impl Service {
|
|||
&self,
|
||||
room_id: &RoomId,
|
||||
new_state_ids_compressed: HashSet<CompressedStateEvent>,
|
||||
) -> Result<(u64, HashSet<CompressedStateEvent>, HashSet<CompressedStateEvent>)> {
|
||||
) -> Result<(
|
||||
u64,
|
||||
HashSet<CompressedStateEvent>,
|
||||
HashSet<CompressedStateEvent>,
|
||||
)> {
|
||||
let previous_shortstatehash = services().rooms.state.get_room_shortstatehash(room_id)?;
|
||||
|
||||
let state_hash = utils::calculate_hash(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use ruma::{signatures::CanonicalJsonObject, EventId, RoomId, UserId};
|
||||
use ruma::{CanonicalJsonObject, EventId, OwnedUserId, RoomId, UserId};
|
||||
|
||||
use crate::{PduEvent, Result};
|
||||
|
||||
|
@ -81,7 +81,7 @@ pub trait Data: Send + Sync {
|
|||
fn increment_notification_counts(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
notifies: Vec<Box<UserId>>,
|
||||
highlights: Vec<Box<UserId>>,
|
||||
notifies: Vec<OwnedUserId>,
|
||||
highlights: Vec<OwnedUserId>,
|
||||
) -> Result<()>;
|
||||
}
|
||||
|
|
|
@ -7,10 +7,15 @@ use std::sync::{Arc, Mutex};
|
|||
|
||||
pub use data::Data;
|
||||
use regex::Regex;
|
||||
use ruma::canonical_json::to_canonical_value;
|
||||
use ruma::events::room::power_levels::RoomPowerLevelsEventContent;
|
||||
use ruma::push::Ruleset;
|
||||
use ruma::signatures::CanonicalJsonValue;
|
||||
use ruma::state_res::RoomVersion;
|
||||
use ruma::CanonicalJsonObject;
|
||||
use ruma::CanonicalJsonValue;
|
||||
use ruma::OwnedEventId;
|
||||
use ruma::OwnedRoomId;
|
||||
use ruma::OwnedServerName;
|
||||
use ruma::{
|
||||
api::client::error::ErrorKind,
|
||||
events::{
|
||||
|
@ -19,8 +24,6 @@ use ruma::{
|
|||
GlobalAccountDataEventType, RoomEventType, StateEventType,
|
||||
},
|
||||
push::{Action, Tweak},
|
||||
serde::to_canonical_value,
|
||||
signatures::CanonicalJsonObject,
|
||||
state_res, uint, EventId, RoomAliasId, RoomId, ServerName, UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
@ -38,7 +41,7 @@ use super::state_compressor::CompressedStateEvent;
|
|||
pub struct Service {
|
||||
pub db: &'static dyn Data,
|
||||
|
||||
pub lasttimelinecount_cache: Mutex<HashMap<Box<RoomId>, u64>>,
|
||||
pub lasttimelinecount_cache: Mutex<HashMap<OwnedRoomId, u64>>,
|
||||
}
|
||||
|
||||
impl Service {
|
||||
|
@ -146,7 +149,7 @@ impl Service {
|
|||
&self,
|
||||
pdu: &PduEvent,
|
||||
mut pdu_json: CanonicalJsonObject,
|
||||
leaves: Vec<Box<EventId>>,
|
||||
leaves: Vec<OwnedEventId>,
|
||||
state_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
|
||||
) -> Result<Vec<u8>> {
|
||||
let shortroomid = services()
|
||||
|
@ -702,7 +705,7 @@ impl Service {
|
|||
.state
|
||||
.set_room_state(room_id, statehashid, state_lock)?;
|
||||
|
||||
let mut servers: HashSet<Box<ServerName>> = services()
|
||||
let mut servers: HashSet<OwnedServerName> = services()
|
||||
.rooms
|
||||
.state_cache
|
||||
.room_servers(room_id)
|
||||
|
@ -716,7 +719,7 @@ impl Service {
|
|||
.as_ref()
|
||||
.and_then(|state_key| UserId::parse(state_key.as_str()).ok())
|
||||
{
|
||||
servers.insert(Box::from(state_key_uid.server_name()));
|
||||
servers.insert(state_key_uid.server_name().to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,7 +738,7 @@ impl Service {
|
|||
&self,
|
||||
pdu: &PduEvent,
|
||||
pdu_json: CanonicalJsonObject,
|
||||
new_room_leaves: Vec<Box<EventId>>,
|
||||
new_room_leaves: Vec<OwnedEventId>,
|
||||
state_ids_compressed: HashSet<CompressedStateEvent>,
|
||||
soft_fail: bool,
|
||||
state_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Result;
|
||||
use ruma::{RoomId, UserId};
|
||||
use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId};
|
||||
|
||||
pub trait Data: Send + Sync {
|
||||
fn reset_notification_counts(&self, user_id: &UserId, room_id: &RoomId) -> Result<()>;
|
||||
|
@ -19,6 +19,6 @@ pub trait Data: Send + Sync {
|
|||
|
||||
fn get_shared_rooms<'a>(
|
||||
&'a self,
|
||||
users: Vec<Box<UserId>>,
|
||||
) -> Result<Box<dyn Iterator<Item = Result<Box<RoomId>>> + 'a>>;
|
||||
users: Vec<OwnedUserId>,
|
||||
) -> Result<Box<dyn Iterator<Item = Result<OwnedRoomId>> + 'a>>;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod data;
|
||||
|
||||
pub use data::Data;
|
||||
use ruma::{RoomId, UserId};
|
||||
use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
@ -38,8 +38,8 @@ impl Service {
|
|||
|
||||
pub fn get_shared_rooms<'a>(
|
||||
&'a self,
|
||||
users: Vec<Box<UserId>>,
|
||||
) -> Result<impl Iterator<Item = Result<Box<RoomId>>> + 'a> {
|
||||
users: Vec<OwnedUserId>,
|
||||
) -> Result<impl Iterator<Item = Result<OwnedRoomId>> + 'a> {
|
||||
self.db.get_shared_rooms(users)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue