Update dependencies and send displayname updates again

This commit is contained in:
timokoesters 2020-05-08 21:13:52 +02:00
parent 8f67c01efd
commit 551308e9a8
No known key found for this signature in database
GPG key ID: 356E705610F626D5
6 changed files with 123 additions and 112 deletions

154
Cargo.lock generated
View file

@ -24,9 +24,9 @@ version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -69,9 +69,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]]
name = "base64"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3"
checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42"
[[package]]
name = "bitflags"
@ -133,7 +133,7 @@ dependencies = [
name = "conduit"
version = "0.1.0"
dependencies = [
"base64 0.12.0",
"base64 0.12.1",
"directories",
"http",
"js_int",
@ -143,6 +143,7 @@ dependencies = [
"rocket",
"ruma-api",
"ruma-client-api",
"ruma-common",
"ruma-events",
"ruma-federation-api",
"ruma-identifiers",
@ -247,9 +248,9 @@ version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089"
dependencies = [
"bitflags",
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -391,9 +392,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
dependencies = [
"proc-macro-hack",
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -449,9 +450,9 @@ dependencies = [
[[package]]
name = "h2"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42"
checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff"
dependencies = [
"bytes",
"fnv",
@ -705,9 +706,9 @@ dependencies = [
[[package]]
name = "mio-uds"
version = "0.6.7"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
@ -746,9 +747,9 @@ dependencies = [
[[package]]
name = "net2"
version = "0.2.33"
version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
dependencies = [
"cfg-if",
"libc",
@ -793,9 +794,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-sys"
version = "0.9.55"
version = "0.9.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8"
checksum = "f02309a7f127000ed50594f0b50ecc69e7c654e16d41b4e8156d1b3df8e0b52e"
dependencies = [
"autocfg",
"cc",
@ -864,29 +865,29 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-project"
version = "0.4.9"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2"
checksum = "82c3bfbfb5bb42f99498c7234bbd768c220eb0cea6818259d0d18a1aa3d2595d"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.9"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a"
checksum = "ccbf6449dcfb18562c015526b085b8df1aa3cdab180af8ec2ebd300a3bd28f63"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
name = "pin-project-lite"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae"
checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f"
[[package]]
name = "pin-utils"
@ -929,9 +930,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.10"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3"
checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319"
dependencies = [
"unicode-xid 0.2.0",
]
@ -951,7 +952,7 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c1f4b0efa5fc5e8ceb705136bfee52cfdb6a4e3509f770b478cd6ed434232a7"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
]
[[package]]
@ -1132,55 +1133,68 @@ dependencies = [
[[package]]
name = "ruma-api"
version = "0.16.0-rc.3"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c296a951625ccc8c04d5188f1791d1628503c8614073a05833af9fed18b029c1"
checksum = "f4d1f23ec408993a39acb852a311a5469422b0c087a6497efeb0ad9c04ad72db"
dependencies = [
"http",
"percent-encoding 2.1.0",
"ruma-api-macros",
"ruma-identifiers",
"ruma-serde",
"serde",
"serde_json",
"serde_urlencoded",
"strum",
]
[[package]]
name = "ruma-api-macros"
version = "0.16.0-rc.3"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f6b02a6a860a96e3c2081c8aea88b37b2918b53e539856b73aadde1908b65ad"
checksum = "8ae19a3485b607be10c07f0e6a1c672e8cc2693a50a29f25195f7034dbe7859c"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
name = "ruma-client-api"
version = "0.8.0-rc.5"
source = "git+https://github.com/ruma/ruma-client-api.git#06f83742506e06d6d2731667eb9fa081654455cf"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a57433fc6dded259aef2b12ceb91d78d3607b182278f648edd5c19c23d81cd"
dependencies = [
"http",
"js_int",
"ruma-api",
"ruma-common",
"ruma-events",
"ruma-identifiers",
"ruma-serde",
"serde",
"serde_json",
"strum",
"url",
]
[[package]]
name = "ruma-common"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "235f2fed35114ef3fbff1b7d5350f22ac712cffff55cc7b7732d39ae4adf6966"
dependencies = [
"ruma-serde",
"serde",
"serde_json",
]
[[package]]
name = "ruma-events"
version = "0.21.0-beta.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4802476bbe517f2ac6cb7b1cf4869d54586c10e86e2ddc00806cafa32a96553"
checksum = "ca4eff279e18bdb3daba46381eb08ac5b2d4ab471271b8c2f597073dcbadc415"
dependencies = [
"js_int",
"ruma-common",
"ruma-events-macros",
"ruma-identifiers",
"ruma-serde",
@ -1190,13 +1204,13 @@ dependencies = [
[[package]]
name = "ruma-events-macros"
version = "0.21.0-beta.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abd3cfe96c9887fe2eebfa2e5e7d3a4afff02c374874d4e718f46dab5fd3320d"
checksum = "2e32130570495f21f922ffa0127438228d475e5f8dfcc201d77b8e717ce1c0f0"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -1215,19 +1229,18 @@ dependencies = [
[[package]]
name = "ruma-identifiers"
version = "0.16.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ee548c5dbb5a92a93bb435fd3b66484cd19b0f37450c9b93677338cbe9550d2"
checksum = "77c93b9d5f951a2fb57b19c048a05ac1dbdb280ff7617ec6b02f54bf14318ed8"
dependencies = [
"rand",
"serde",
]
[[package]]
name = "ruma-serde"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce9a52acce7ed3809e1b47d9cc67ee93972a2b0fedaaa76d6e794456a79858b"
checksum = "e14edc0e2f5177c419e3b89060b1e94fb3af81b2f253783ac6967f14a7ec3911"
dependencies = [
"dtoa",
"itoa",
@ -1242,7 +1255,7 @@ name = "ruma-signatures"
version = "0.6.0-dev.1"
source = "git+https://github.com/ruma/ruma-signatures.git#1ca545cba8dfd43e0fc8e3c18e1311fb73390a97"
dependencies = [
"base64 0.12.0",
"base64 0.12.1",
"ring",
"serde_json",
"untrusted",
@ -1266,7 +1279,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19"
dependencies = [
"base64 0.12.0",
"base64 0.12.1",
"blake2b_simd",
"constant_time_eq",
"crossbeam-utils",
@ -1319,9 +1332,9 @@ dependencies = [
[[package]]
name = "security-framework"
version = "0.4.3"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f331b9025654145cd425b9ded0caf8f5ae0df80d418b326e2dc1c3dc5eb0620"
checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
dependencies = [
"bitflags",
"core-foundation",
@ -1355,9 +1368,9 @@ version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -1449,9 +1462,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
dependencies = [
"heck",
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -1467,11 +1480,11 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213"
checksum = "e8e5aa70697bb26ee62214ae3288465ecec0000f05182f039b477001f08f5ae7"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"unicode-xid 0.2.0",
]
@ -1505,9 +1518,9 @@ version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f34e0c1caaa462fd840ec6b768946ea1e7842620d94fe29d5b847138f521269"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -1549,9 +1562,9 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
]
[[package]]
@ -1568,9 +1581,9 @@ dependencies = [
[[package]]
name = "tokio-tls"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828"
checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343"
dependencies = [
"native-tls",
"tokio",
@ -1671,7 +1684,6 @@ dependencies = [
"idna",
"matches",
"percent-encoding 2.1.0",
"serde",
]
[[package]]
@ -1729,9 +1741,9 @@ dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
"wasm-bindgen-shared",
]
@ -1763,9 +1775,9 @@ version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
"syn 1.0.19",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View file

@ -4,6 +4,7 @@ description = "A Matrix homeserver written in Rust"
license = "AGPL-3.0"
authors = ["timokoesters <timo@koesters.xyz>"]
homepage = "https://conduit.rs"
repository = "https://git.koesters.xyz/timo/conduit"
readme = "README.md"
version = "0.1.0"
edition = "2018"
@ -13,10 +14,10 @@ edition = "2018"
[dependencies]
rocket = { git = "https://github.com/SergioBenitez/Rocket.git", branch = "async", features = ["tls"] }
http = "0.2.1"
ruma-client-api = { git = "https://github.com/ruma/ruma-client-api.git" }
ruma-identifiers = { version = "0.16.0", features = ["rand"] }
ruma-api = "0.16.0-rc.3"
ruma-events = "0.21.0-beta.1"
ruma-client-api = "0.8.0"
ruma-identifiers = "0.16.1"
ruma-api = "0.16.0"
ruma-events = "0.21.0"
ruma-signatures = { git = "https://github.com/ruma/ruma-signatures.git" }
ruma-federation-api = { git = "https://github.com/ruma/ruma-federation-api.git" }
log = "0.4.8"
@ -29,5 +30,6 @@ tokio = { version = "0.2.20", features = ["macros"] }
rand = "0.7.3"
rust-argon2 = "0.8.2"
reqwest = "0.10.4"
base64 = "0.12.0"
base64 = "0.12.1"
thiserror = "1.0.16"
ruma-common = "0.1.1"

View file

@ -12,7 +12,7 @@ use ruma_client_api::{
account::{get_username_availability, register},
alias::get_alias,
capabilities::get_capabilities,
client_exchange::send_event_to_device,
to_device::send_event_to_device,
config::{get_global_account_data, set_global_account_data},
directory::{self, get_public_rooms_filtered},
filter::{self, create_filter, get_filter},
@ -42,7 +42,7 @@ use ruma_client_api::{
};
use ruma_events::{collections::only::Event as EduEvent, EventType};
use ruma_identifiers::{RoomId, UserId};
use serde_json::json;
use serde_json::{json, value::RawValue};
use crate::{server_server, utils, Database, MatrixResult, Ruma};
@ -105,7 +105,7 @@ pub fn register_route(
stages: vec!["m.login.dummy".to_owned()],
}],
completed: vec![],
params: json!({}),
params: RawValue::from_string("".to_owned()).unwrap(),
session: Some(utils::random_string(SESSION_ID_LENGTH)),
auth_error: None,
})));
@ -185,7 +185,7 @@ pub fn register_route(
actions: vec![
ruma_events::push_rules::Action::Notify,
ruma_events::push_rules::Action::SetTweak(
ruma_events::push_rules::Tweak::Highlight { value: false },
ruma_common::push::Tweak::Highlight(false),
),
],
default: true,
@ -318,10 +318,7 @@ pub fn get_pushrules_all_route() -> MatrixResult<get_pushrules_all::Response> {
vec![push::PushRule {
actions: vec![
push::Action::Notify,
push::Action::SetTweak {
kind: push::TweakKind::Highlight,
value: Some(false.into()),
},
push::Action::SetTweak(ruma_common::push::Tweak::Highlight(false))
],
default: true,
enabled: true,
@ -363,7 +360,7 @@ pub fn set_pushrule_route(
actions: vec![
ruma_events::push_rules::Action::Notify,
ruma_events::push_rules::Action::SetTweak(
ruma_events::push_rules::Tweak::Highlight { value: false },
ruma_common::push::Tweak::Highlight(false),
),
],
default: true,
@ -467,8 +464,21 @@ pub fn set_displayname_route(
.users
.set_displayname(&user_id, Some(displayname.clone()))
.unwrap();
// TODO: send a new m.presence event with the updated displayname
}
// Send a new membership event into all joined rooms
for room_id in db.rooms.rooms_joined(&user_id) {
db.rooms.append_pdu(
room_id.unwrap(),
user_id.clone(),
EventType::RoomMember,
json!({"membership": "join", "displayname": displayname}),
None,
Some(user_id.to_string()),
&db.globals
).unwrap();
}
// TODO: send a new m.presence event
} else {
// Send error on None
// Synapse returns a parsing error but the spec doesn't require this
@ -734,7 +744,7 @@ pub fn create_room_route(
body: Ruma<create_room::Request>,
) -> MatrixResult<create_room::Response> {
// TODO: check if room is unique
let room_id = RoomId::new(db.globals.hostname()).expect("host is valid");
let room_id = RoomId::try_from(db.globals.hostname()).expect("host is valid");
let user_id = body.user_id.clone().expect("user is authenticated");
db
@ -1104,7 +1114,7 @@ pub fn create_message_event_route(
)
.expect("message events are always okay");
MatrixResult(Ok(create_message_event::Response { event_id }))
MatrixResult(Ok(create_message_event::Response { event_id: Some(event_id) }))
}
#[put(
@ -1134,7 +1144,7 @@ pub fn create_state_event_for_key_route(
)
.unwrap();
MatrixResult(Ok(create_state_event_for_key::Response { event_id }))
MatrixResult(Ok(create_state_event_for_key::Response { event_id: Some(event_id) }))
}
#[put(
@ -1163,7 +1173,7 @@ pub fn create_state_event_for_empty_key_route(
)
.unwrap();
MatrixResult(Ok(create_state_event_for_empty_key::Response { event_id }))
MatrixResult(Ok(create_state_event_for_empty_key::Response { event_id: Some(event_id) }))
}
#[get("/_matrix/client/r0/sync", data = "<body>")]
@ -1171,7 +1181,7 @@ pub fn sync_route(
db: State<'_, Database>,
body: Ruma<sync_events::Request>,
) -> MatrixResult<sync_events::Response> {
std::thread::sleep(Duration::from_millis(100));
std::thread::sleep(Duration::from_millis(1500));
let user_id = body.user_id.clone().expect("user is authenticated");
let next_batch = db.globals.current_count().unwrap().to_string();

View file

@ -40,7 +40,7 @@ impl Database {
globals: globals::Globals::load(db.open_tree("global").unwrap(), hostname.to_owned()),
users: users::Users {
userid_password: db.open_tree("userid_password").unwrap(),
userdeviceid: db.open_tree("userdeviceid").unwrap(),
userdeviceids: db.open_tree("userdeviceids").unwrap(),
userid_displayname: db.open_tree("userid_displayname").unwrap(),
userid_avatarurl: db.open_tree("userid_avatarurl").unwrap(),
userdeviceid_token: db.open_tree("userdeviceid_token").unwrap(),
@ -49,8 +49,8 @@ impl Database {
rooms: rooms::Rooms {
edus: rooms::RoomEdus {
roomuserid_lastread: db.open_tree("roomuserid_lastread").unwrap(),
roomlatestid_roomlatest: db.open_tree("roomlatestid_roomlatest").unwrap(),
roomactiveid_roomactive: db.open_tree("roomactiveid_roomactive").unwrap(),
roomlatestid_roomlatest: db.open_tree("roomlatestid_roomlatest").unwrap(), // Read receipts
roomactiveid_roomactive: db.open_tree("roomactiveid_roomactive").unwrap(), // Typing notifs
},
pduid_pdu: db.open_tree("pduid_pdu").unwrap(),
eventid_pduid: db.open_tree("eventid_pduid").unwrap(),

View file

@ -17,7 +17,7 @@ pub struct Rooms {
pub(super) pduid_pdu: sled::Tree, // PduId = RoomId + Count
pub(super) eventid_pduid: sled::Tree,
pub(super) roomid_pduleaves: sled::Tree,
pub(super) roomstateid_pdu: sled::Tree, // Room + StateType + StateKey
pub(super) roomstateid_pdu: sled::Tree, // RoomStateId = Room + StateType + StateKey
pub(super) userroomid_joined: sled::Tree,
pub(super) roomuserid_joined: sled::Tree,
@ -29,11 +29,10 @@ pub struct Rooms {
impl Rooms {
/// Checks if a room exists.
pub fn exists(&self, room_id: &RoomId) -> Result<bool> {
// Look for PDUs in that room.
let mut prefix = room_id.to_string().as_bytes().to_vec();
prefix.push(0xff);
// Look for PDUs in that room.
Ok(self
.pduid_pdu
.get_gt(&prefix)?

View file

@ -6,7 +6,7 @@ pub struct Users {
pub(super) userid_password: sled::Tree,
pub(super) userid_displayname: sled::Tree,
pub(super) userid_avatarurl: sled::Tree,
pub(super) userdeviceid: sled::Tree,
pub(super) userdeviceids: sled::Tree,
pub(super) userdeviceid_token: sled::Tree,
pub(super) token_userid: sled::Tree,
}
@ -63,18 +63,6 @@ impl Users {
}
Ok(())
/* TODO:
for room_id in self.rooms_joined(user_id) {
self.pdu_append(
room_id.clone(),
user_id.clone(),
EventType::RoomMember,
json!({"membership": "join", "displayname": displayname}),
None,
Some(user_id.to_string()),
);
}
*/
}
/// Get a the avatar_url of a user.
@ -108,7 +96,7 @@ impl Users {
key.push(0xff);
key.extend_from_slice(device_id.as_bytes());
self.userdeviceid.insert(key, &[])?;
self.userdeviceids.insert(key, &[])?;
self.set_token(user_id, device_id, token)?;
@ -121,7 +109,7 @@ impl Users {
key.push(0xff);
key.extend_from_slice(device_id.as_bytes());
if self.userdeviceid.get(&key)?.is_none() {
if self.userdeviceids.get(&key)?.is_none() {
return Err(Error::BadRequest(
"Tried to set token for nonexistent device",
));