Update to latest ruma/ruma commit
This will most likely be the API that is released to crates.io so it should be fairly stable...
This commit is contained in:
parent
63e23154f3
commit
d02685a4fd
8 changed files with 205 additions and 217 deletions
|
@ -1,14 +1,14 @@
|
|||
use std::convert::TryFrom;
|
||||
use std::convert::TryInto;
|
||||
|
||||
use crate::{utils, Error, Result};
|
||||
use ruma::identifiers::{ServerName, ServerNameRef};
|
||||
use ruma::identifiers::ServerName;
|
||||
pub const COUNTER: &str = "c";
|
||||
|
||||
pub struct Globals {
|
||||
pub(super) globals: sled::Tree,
|
||||
keypair: ruma::signatures::Ed25519KeyPair,
|
||||
reqwest_client: reqwest::Client,
|
||||
server_name: ServerName,
|
||||
server_name: Box<ServerName>,
|
||||
registration_disabled: bool,
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,12 @@ impl Globals {
|
|||
globals,
|
||||
keypair,
|
||||
reqwest_client: reqwest::Client::new(),
|
||||
server_name: ServerName::try_from(
|
||||
config
|
||||
.get_str("server_name")
|
||||
.unwrap_or("localhost")
|
||||
.to_owned(),
|
||||
)
|
||||
.map_err(|_| Error::BadConfig("Invalid server name"))?,
|
||||
server_name: config
|
||||
.get_str("server_name")
|
||||
.unwrap_or("localhost")
|
||||
.to_string()
|
||||
.try_into()
|
||||
.map_err(|_| crate::Error::bad_database("Private or public keys are invalid."))?,
|
||||
registration_disabled: config.get_bool("registration_disabled").unwrap_or(false),
|
||||
})
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ impl Globals {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn server_name(&self) -> ServerNameRef<'_> {
|
||||
pub fn server_name(&self) -> &ServerName {
|
||||
self.server_name.as_ref()
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{utils, Error, Result};
|
|||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
r0::backup::{get_backup_keys::Sessions, BackupAlgorithm, KeyData},
|
||||
r0::backup::{BackupAlgorithm, KeyData, Sessions},
|
||||
},
|
||||
identifiers::{RoomId, UserId},
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ impl RoomEdus {
|
|||
&self,
|
||||
room_id: &RoomId,
|
||||
since: u64,
|
||||
) -> Result<impl Iterator<Item = Result<EventJson<ruma::events::AnyEphemeralRoomEventStub>>>>
|
||||
) -> Result<impl Iterator<Item = Result<EventJson<ruma::events::AnySyncEphemeralRoomEvent>>>>
|
||||
{
|
||||
let mut prefix = room_id.to_string().as_bytes().to_vec();
|
||||
prefix.push(0xff);
|
||||
|
|
|
@ -9,7 +9,7 @@ use ruma::{
|
|||
},
|
||||
},
|
||||
events::{AnyToDeviceEvent, EventJson, EventType},
|
||||
identifiers::UserId,
|
||||
identifiers::{DeviceId, UserId},
|
||||
};
|
||||
use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime};
|
||||
|
||||
|
@ -168,7 +168,7 @@ impl Users {
|
|||
pub fn create_device(
|
||||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: &str,
|
||||
device_id: &DeviceId,
|
||||
token: &str,
|
||||
initial_device_display_name: Option<String>,
|
||||
) -> Result<()> {
|
||||
|
@ -182,7 +182,7 @@ impl Users {
|
|||
self.userdeviceid_metadata.insert(
|
||||
userdeviceid,
|
||||
serde_json::to_string(&Device {
|
||||
device_id: device_id.to_owned(),
|
||||
device_id: device_id.to_string().into_boxed_str(),
|
||||
display_name: initial_device_display_name,
|
||||
last_seen_ip: None, // TODO
|
||||
last_seen_ts: Some(SystemTime::now()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue