Update ruma to latest, renamed server keys and removed PduStub
This commit is contained in:
parent
b869aab5d0
commit
164b1633d8
19 changed files with 123 additions and 87 deletions
|
@ -2,7 +2,8 @@ use crate::{utils, Error, Result};
|
|||
use ruma::{
|
||||
api::client::error::ErrorKind,
|
||||
events::{AnyEvent as EduEvent, EventType},
|
||||
Raw, RoomId, UserId,
|
||||
serde::Raw,
|
||||
RoomId, UserId,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use sled::IVec;
|
||||
|
|
|
@ -3,7 +3,10 @@ use std::convert::{TryFrom, TryInto};
|
|||
use crate::pdu::PduBuilder;
|
||||
use log::warn;
|
||||
use rocket::futures::{channel::mpsc, stream::StreamExt};
|
||||
use ruma::{events::room::message, events::EventType, UserId};
|
||||
use ruma::{
|
||||
events::{room::message, EventType},
|
||||
UserId,
|
||||
};
|
||||
use tokio::select;
|
||||
|
||||
pub enum AdminCommand {
|
||||
|
|
|
@ -15,8 +15,8 @@ use ruma::{
|
|||
},
|
||||
EventType,
|
||||
},
|
||||
serde::{to_canonical_value, CanonicalJsonObject},
|
||||
EventId, Raw, RoomAliasId, RoomId, RoomVersionId, ServerName, UserId,
|
||||
serde::{to_canonical_value, CanonicalJsonObject, Raw},
|
||||
EventId, RoomAliasId, RoomId, RoomVersionId, ServerName, UserId,
|
||||
};
|
||||
use sled::IVec;
|
||||
use state_res::{event_auth, Error as StateError, Requester, StateEvent, StateMap, StateStore};
|
||||
|
@ -102,7 +102,7 @@ impl StateStore for Rooms {
|
|||
.and_then(|pdu: StateEvent| {
|
||||
// conduit's PDU's always contain a room_id but some
|
||||
// of ruma's do not so this must be an Option
|
||||
if pdu.room_id() == Some(room_id) {
|
||||
if pdu.room_id() == room_id {
|
||||
Ok(Arc::new(pdu))
|
||||
} else {
|
||||
Err(StateError::NotFound(
|
||||
|
@ -278,7 +278,7 @@ impl Rooms {
|
|||
|
||||
for ((event_type, state_key), pdu_id) in state {
|
||||
let mut state_id = prefix.clone();
|
||||
state_id.extend_from_slice(&event_type.as_str().as_bytes());
|
||||
state_id.extend_from_slice(&event_type.as_ref().as_bytes());
|
||||
state_id.push(0xff);
|
||||
state_id.extend_from_slice(&state_key.as_bytes());
|
||||
self.stateid_pduid.insert(state_id, pdu_id)?;
|
||||
|
@ -592,6 +592,7 @@ impl Rooms {
|
|||
body: format!("Command: {}, Args: {:?}", command, args),
|
||||
formatted: None,
|
||||
relates_to: None,
|
||||
new_content: None,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
@ -633,7 +634,7 @@ impl Rooms {
|
|||
|
||||
if let Some(state_key) = &new_pdu.state_key {
|
||||
let mut new_state = old_state;
|
||||
let mut pdu_key = new_pdu.kind.as_str().as_bytes().to_vec();
|
||||
let mut pdu_key = new_pdu.kind.as_ref().as_bytes().to_vec();
|
||||
pdu_key.push(0xff);
|
||||
pdu_key.extend_from_slice(state_key.as_bytes());
|
||||
new_state.insert(pdu_key.into(), new_pdu_id.into());
|
||||
|
|
|
@ -6,7 +6,8 @@ use ruma::{
|
|||
AnyEvent as EduEvent, SyncEphemeralRoomEvent,
|
||||
},
|
||||
presence::PresenceState,
|
||||
Raw, RoomId, UserId,
|
||||
serde::Raw,
|
||||
RoomId, UserId,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
|
|
@ -10,7 +10,8 @@ use ruma::{
|
|||
},
|
||||
encryption::DeviceKeys,
|
||||
events::{AnyToDeviceEvent, EventType},
|
||||
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, Raw, UserId,
|
||||
serde::Raw,
|
||||
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId,
|
||||
};
|
||||
use std::{collections::BTreeMap, convert::TryFrom, mem, time::SystemTime};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue