From f295f2b7b6221cac933156957c786337aed7eed2 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Thu, 13 Apr 2023 19:04:48 +0000 Subject: [PATCH] Update to Matrix SDK 0.6 (#98) Quite a few changes involved. Mostly variable renames and a few changes to `await`s. Not ready yet because bot cannot login due to some arcane error of `expected value at line 1 column 1`. Co-authored-by: projectmoon Reviewed-on: https://git.agnos.is/projectmoon/tenebrous-dicebot/pulls/98 --- Cargo.lock | 1336 ++++++++++++++------------ dicebot/Cargo.toml | 4 +- dicebot/src/bin/dicebot-cmd.rs | 4 +- dicebot/src/bin/dicebot.rs | 4 +- dicebot/src/bot/command_execution.rs | 8 +- dicebot/src/bot/event_handlers.rs | 51 +- dicebot/src/bot/mod.rs | 33 +- dicebot/src/cofd/dice.rs | 8 +- dicebot/src/commands/mod.rs | 15 +- dicebot/src/commands/rooms.rs | 6 +- dicebot/src/context.rs | 13 +- dicebot/src/cthulhu/dice.rs | 11 +- dicebot/src/error.rs | 13 +- dicebot/src/matrix.rs | 28 +- dicebot/src/rpc/service.rs | 6 +- 15 files changed, 815 insertions(+), 725 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eade8dc..df52d05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,18 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - [[package]] name = "aead" version = "0.4.3" @@ -21,33 +9,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", + "rand_core 0.6.4", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures", - "ctr", - "opaque-debug", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", ] [[package]] @@ -94,6 +67,12 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "arrayref" version = "0.3.7" @@ -106,12 +85,36 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +dependencies = [ + "serde", +] + [[package]] name = "assign" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002" +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-once-cell" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72faff1fdc615a0199d7bf71e6f389af54d46a66e9beb5d76c39e48eda93ecce" + [[package]] name = "async-stream" version = "0.3.4" @@ -160,7 +163,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" dependencies = [ - "autocfg", + "autocfg 1.1.0", +] + +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", ] [[package]] @@ -171,14 +183,14 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backoff" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fe17f59a06fe8b87a6fc8bf53bb70b3aba76d7685f432487a68cd5552853625" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", "getrandom 0.2.8", "instant", - "pin-project", + "pin-project-lite", "rand 0.8.5", "tokio", ] @@ -201,6 +213,12 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bitflags" version = "1.3.2" @@ -214,8 +232,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" dependencies = [ "arrayref", - "arrayvec", - "constant_time_eq", + "arrayvec 0.5.2", + "constant_time_eq 0.1.5", +] + +[[package]] +name = "blake3" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "cc", + "cfg-if", + "constant_time_eq 0.2.5", + "digest 0.10.6", ] [[package]] @@ -236,18 +268,21 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" -[[package]] -name = "bytemuck" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" - [[package]] name = "byteorder" version = "1.4.3" @@ -260,6 +295,15 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher 0.4.4", +] + [[package]] name = "cc" version = "1.0.79" @@ -279,7 +323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "zeroize", ] @@ -292,17 +336,11 @@ checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ "aead", "chacha20", - "cipher", + "cipher 0.3.0", "poly1305", "zeroize", ] -[[package]] -name = "checked_int_cast" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919" - [[package]] name = "chrono" version = "0.4.24" @@ -325,12 +363,22 @@ dependencies = [ ] [[package]] -name = "cmake" -version = "0.1.50" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "cc", + "crypto-common", + "inout", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", ] [[package]] @@ -343,12 +391,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "combine" version = "4.6.6" @@ -361,9 +403,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "constant_time_eq" @@ -371,6 +413,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "constant_time_eq" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" + [[package]] name = "core-foundation" version = "0.9.3" @@ -420,34 +468,13 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - [[package]] name = "crossbeam-epoch" version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ - "autocfg", + "autocfg 1.1.0", "cfg-if", "crossbeam-utils", "memoffset", @@ -483,23 +510,13 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] @@ -511,6 +528,7 @@ dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", + "serde", "subtle", "zeroize", ] @@ -560,34 +578,93 @@ dependencies = [ ] [[package]] -name = "dashmap" -version = "4.0.2" +name = "darling" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" dependencies = [ - "cfg-if", - "num_cpus", + "darling_core", + "darling_macro", ] [[package]] -name = "deflate" -version = "0.8.6" +name = "darling_core" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ - "adler32", - "byteorder", + "fnv", + "ident_case", + "proc-macro2 1.0.56", + "quote 1.0.26", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote 1.0.26", + "syn 1.0.109", +] + +[[package]] +name = "dashmap" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +dependencies = [ + "cfg-if", + "hashbrown 0.12.3", + "lock_api", + "once_cell", + "parking_lot_core 0.9.7", ] [[package]] name = "der" -version = "0.4.5" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" dependencies = [ "const-oid", ] +[[package]] +name = "derive_builder" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -605,6 +682,7 @@ checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.4", "crypto-common", + "subtle", ] [[package]] @@ -627,6 +705,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "displaydoc" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.109", +] + [[package]] name = "dotenv" version = "0.15.0" @@ -639,6 +734,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ + "serde", "signature", ] @@ -652,6 +748,7 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", + "serde_bytes", "sha2 0.9.9", "zeroize", ] @@ -786,6 +883,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "fuse-rust" version = "0.2.0" @@ -864,15 +967,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" -[[package]] -name = "futures-locks" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c4e684ddb2d8a4db5ca8a02b35156da129674ba4412b6f528698d58c594954" -dependencies = [ - "futures", -] - [[package]] name = "futures-macro" version = "0.3.28" @@ -884,6 +978,20 @@ dependencies = [ "syn 2.0.13", ] +[[package]] +name = "futures-signals" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36a12cb78961d5c0bc0e358599bba98ec09201090a22339cd8ea27e815c11b25" +dependencies = [ + "discard", + "futures-channel", + "futures-core", + "futures-util", + "gensym", + "pin-project", +] + [[package]] name = "futures-sink" version = "0.3.28" @@ -896,16 +1004,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" -dependencies = [ - "gloo-timers", - "send_wrapper", -] - [[package]] name = "futures-util" version = "0.3.28" @@ -933,34 +1031,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "g2gen" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc100b16c63808c5c388cd23ff94c5a35cf28ea459f336323f7948a39480555" -dependencies = [ - "g2poly", - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", -] - -[[package]] -name = "g2p" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf09bc632629cbe5420b330e45bcc8f80403e74ba1027d213258914fd5c62755" -dependencies = [ - "g2gen", - "g2poly", -] - -[[package]] -name = "g2poly" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e837767888fca507f07e89c90e0b350da7bbb89170f67a4655dc9bdc4cca457b" - [[package]] name = "generic-array" version = "0.14.7" @@ -971,6 +1041,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "gensym" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb328fe25cbf075818a3e57bb5ee39b49b4f26c94d685356426154c5962cccd" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", + "uuid 0.7.4", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -978,8 +1060,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -995,38 +1079,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gif" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "h2" version = "0.3.16" @@ -1046,12 +1098,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" - [[package]] name = "hashbrown" version = "0.11.2" @@ -1061,6 +1107,15 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + [[package]] name = "hashlink" version = "0.7.0" @@ -1110,13 +1165,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hmac" -version = "0.11.0" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ - "crypto-mac", - "digest 0.9.0", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", ] [[package]] @@ -1152,7 +1215,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", - "itoa 1.0.6", + "itoa", ] [[package]] @@ -1193,7 +1256,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.6", + "itoa", "pin-project-lite", "socket2", "tokio", @@ -1239,6 +1302,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -1250,32 +1319,27 @@ dependencies = [ ] [[package]] -name = "image" -version = "0.23.14" +name = "indexed_db_futures" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" +checksum = "d26ac735f676c52305becf53264b91cea9866a8de61ccbf464405b377b9cbca9" dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "gif", - "jpeg-decoder", - "num-iter", - "num-rational", - "num-traits", - "png", - "scoped_threadpool", - "tiff", + "cfg-if", + "js-sys", + "uuid 0.8.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] name = "indexmap" -version = "1.6.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg", - "hashbrown 0.9.1", + "autocfg 1.1.0", + "hashbrown 0.12.3", "serde", ] @@ -1285,6 +1349,16 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -1332,27 +1406,12 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" -dependencies = [ - "rayon", -] - [[package]] name = "js-sys" version = "0.3.61" @@ -1371,6 +1430,15 @@ dependencies = [ "serde", ] +[[package]] +name = "js_option" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68421373957a1593a767013698dbf206e2b221eefe97a44d98d18672ff38423c" +dependencies = [ + "serde", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1383,7 +1451,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", "bitflags", "cfg-if", "ryu", @@ -1428,7 +1496,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ - "autocfg", + "autocfg 1.1.0", "scopeguard", ] @@ -1443,11 +1511,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.6.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "hashbrown 0.11.2", + "hashbrown 0.12.3", ] [[package]] @@ -1497,36 +1565,29 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "matrix-qrcode" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4231739aa2ff90c6c55b07d7179c52b496622a86fc2f7e0431336d109ba7838d" -dependencies = [ - "base64 0.13.1", - "byteorder", - "image", - "qrcode", - "rqrr", - "ruma-identifiers", - "thiserror", -] - [[package]] name = "matrix-sdk" -version = "0.4.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5834b96fef26d6d61c8ffd21dda3569c7c0fc688f9cc8aebd35f6f8c3068a186" +checksum = "cbeafb4809f33f377165f2fbcf10e0613053ad206762194c3050a727fd3abcb2" dependencies = [ + "anymap2", + "async-once-cell", + "async-stream", + "async-trait", "backoff", "bytes", "dashmap", + "derive_builder", "event-listener", - "futures", - "futures-timer", + "futures-core", + "futures-signals", + "futures-util", "http", "matrix-sdk-base", "matrix-sdk-common", + "matrix-sdk-indexeddb", + "matrix-sdk-sled", "mime", "reqwest", "ruma", @@ -1535,80 +1596,151 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-futures", "url", + "wasm-timer", "zeroize", ] [[package]] name = "matrix-sdk-base" -version = "0.4.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97c4d675ff70395c1b0cd94fae869cea4efd3f148b74bf4186e969ee622a9c7" +checksum = "b944f6d1fc8779ba790dd0b942ceff45c626c1f5da847f01122d355ad06511bd" dependencies = [ - "chacha20poly1305", + "async-stream", + "async-trait", "dashmap", - "futures", - "hmac", + "futures-channel", + "futures-core", + "futures-signals", + "futures-util", "lru", "matrix-sdk-common", "matrix-sdk-crypto", - "pbkdf2", - "rand 0.8.5", + "once_cell", "ruma", "serde", "serde_json", - "sha2 0.9.9", - "sled", "thiserror", - "tokio", "tracing", "zeroize", ] [[package]] name = "matrix-sdk-common" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c004ca5d02a17eb827a2c3d8e34c9a84c075b42cfed7022895ba6418372ea5" +checksum = "b85a6a743cc9dcf9385e61a26db78276078beddd27f3762d9d82baa2030695f1" dependencies = [ - "async-trait", - "futures", - "futures-locks", + "async-lock", + "futures-core", + "futures-util", "instant", "ruma", "serde", "tokio", - "uuid", "wasm-bindgen-futures", + "wasm-timer", ] [[package]] name = "matrix-sdk-crypto" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36626b188e0ea1d244eef6fe39ab1758c401de6ec84d0389df88f9f6ad761b9" +checksum = "68fa699e8dd54578a4b92e3fcd18a50da8e415a0c042da1706b0330fc2d8f949" dependencies = [ "aes", - "aes-gcm", + "async-trait", "atomic", "base64 0.13.1", "byteorder", + "ctr", "dashmap", - "futures", - "getrandom 0.2.8", + "event-listener", + "futures-util", "hmac", - "matrix-qrcode", "matrix-sdk-common", - "olm-rs", "pbkdf2", + "rand 0.8.5", + "ruma", + "serde", + "serde_json", + "sha2 0.10.6", + "thiserror", + "tokio", + "tracing", + "vodozemac", + "zeroize", +] + +[[package]] +name = "matrix-sdk-indexeddb" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7847d36bba832bc787214323bc042b71dca7fdf2aee9f0e3eb573b64f2f7eb7f" +dependencies = [ + "anyhow", + "async-trait", + "base64 0.13.1", + "dashmap", + "derive_builder", + "getrandom 0.2.8", + "indexed_db_futures", + "js-sys", + "matrix-sdk-base", + "matrix-sdk-crypto", + "matrix-sdk-store-encryption", "ruma", "serde", "serde_json", - "sha2 0.9.9", - "sled", "thiserror", "tracing", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "matrix-sdk-sled" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ded5a703ad8a82b8edfde808228711315c8761a5fbf7ac2b98ab4951dadd066" +dependencies = [ + "async-stream", + "async-trait", + "dashmap", + "derive_builder", + "fs_extra", + "futures-core", + "futures-util", + "matrix-sdk-base", + "matrix-sdk-common", + "matrix-sdk-crypto", + "matrix-sdk-store-encryption", + "ruma", + "serde", + "serde_json", + "sled", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "matrix-sdk-store-encryption" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ddee75c3cca58f3a323283dc4e849d19d52988903f907ed0fb53dcad5d6fd25" +dependencies = [ + "blake3", + "chacha20poly1305", + "displaydoc", + "hmac", + "pbkdf2", + "rand 0.8.5", + "serde", + "serde_json", + "sha2 0.10.6", + "thiserror", "zeroize", ] @@ -1624,7 +1756,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -1639,25 +1771,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - [[package]] name = "mio" version = "0.8.6" @@ -1727,29 +1840,7 @@ version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", + "autocfg 1.1.0", "num-traits", ] @@ -1759,7 +1850,7 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -1772,29 +1863,6 @@ dependencies = [ "libc", ] -[[package]] -name = "olm-rs" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6c2c7054110ce4d7b4756d7b7fe507fea9413968ad0ef8f1d043d504aec725" -dependencies = [ - "getrandom 0.2.8", - "olm-sys", - "serde", - "serde_json", - "zeroize", -] - -[[package]] -name = "olm-sys" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2afecf25624989021f9f0f157f7152102fd147b89445d08449739f216002d339" -dependencies = [ - "cmake", - "fs_extra", -] - [[package]] name = "once_cell" version = "1.17.1" @@ -1899,6 +1967,17 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "paste" version = "1.0.12" @@ -1907,11 +1986,14 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05894bce6a1ba4be299d0c5f29563e08af2bc18bb7d48313113bed71e904739" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "crypto-mac", + "digest 0.10.6", + "hmac", + "password-hash", + "sha2 0.10.6", ] [[package]] @@ -2036,14 +2118,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkcs8" -version = "0.7.6" +name = "pkcs7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3ef9b64d26bad0536099c816c6734379e45bbd5f14798def6809e5cc350447" +checksum = "1f7364e6d0e236473de91e042395d71e0e64715f99a60620b014a4a4c7d1619b" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -2052,18 +2133,6 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide 0.3.7", -] - [[package]] name = "poly1305" version = "0.7.2" @@ -2075,18 +2144,6 @@ dependencies = [ "universal-hash", ] -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2141,7 +2198,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.7.0", +] + +[[package]] +name = "prost" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48e50df39172a3e7eb17e14642445da64996989bc212b583015435d39a58537" +dependencies = [ + "bytes", + "prost-derive 0.11.8", ] [[package]] @@ -2156,7 +2223,7 @@ dependencies = [ "log", "multimap", "petgraph", - "prost", + "prost 0.7.0", "prost-types", "tempfile", "which", @@ -2175,6 +2242,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prost-derive" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea9b0f8cbe5e15a8a042d030bd96668db28ecb567ec37d691971ff5731d2b1b" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 1.0.109", +] + [[package]] name = "prost-types" version = "0.7.0" @@ -2182,17 +2262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" dependencies = [ "bytes", - "prost", -] - -[[package]] -name = "qrcode" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d2f1455f3630c6e5107b4f2b94e74d76dea80736de0981fd27644216cff57f" -dependencies = [ - "checked_int_cast", - "image", + "prost 0.7.0", ] [[package]] @@ -2213,6 +2283,25 @@ dependencies = [ "proc-macro2 1.0.56", ] +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.8", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc 0.1.0", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg 0.1.2", + "rand_xorshift", + "winapi", +] + [[package]] name = "rand" version = "0.7.3" @@ -2223,8 +2312,8 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "rand_hc 0.2.0", + "rand_pcg 0.2.1", ] [[package]] @@ -2238,6 +2327,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.3.1", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -2258,6 +2357,21 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.5.1" @@ -2276,6 +2390,15 @@ dependencies = [ "getrandom 0.2.8", ] +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "rand_hc" version = "0.2.0" @@ -2285,6 +2408,50 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.4.2", +] + [[package]] name = "rand_pcg" version = "0.2.1" @@ -2295,25 +2462,21 @@ dependencies = [ ] [[package]] -name = "rayon" -version = "1.7.0" +name = "rand_xorshift" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" dependencies = [ - "either", - "rayon-core", + "rand_core 0.3.1", ] [[package]] -name = "rayon-core" -version = "1.11.0" +name = "rdrand" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", + "rand_core 0.3.1", ] [[package]] @@ -2452,70 +2615,25 @@ dependencies = [ "winreg", ] -[[package]] -name = "rqrr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a63da014e6f18dbe76e3084feb2f6c5a570ad8d524cc1afff4a6db18404cd" -dependencies = [ - "g2p", - "image", - "lru", -] - [[package]] name = "ruma" -version = "0.4.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668031e3108d6a2cfbe6eca271d8698f4593440e71a44afdadcf67ce3cb93c1f" +checksum = "8dc348e3a4a18abc4e97fffa5e2e623f6edd50ba3a1dd5f47eb249fea713b69f" dependencies = [ "assign", "js_int", - "ruma-api", + "js_option", "ruma-client-api", "ruma-common", - "ruma-events", "ruma-federation-api", - "ruma-identifiers", - "ruma-serde", - "ruma-signatures", - "ruma-state-res", -] - -[[package]] -name = "ruma-api" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda5ec9cf6163bb6be82c8a3994de09fdcd349dcf651aa6cabf649451f361eee" -dependencies = [ - "bytes", - "http", - "percent-encoding", - "ruma-api-macros", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ruma-api-macros" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72984e25b5e66fcce3267e97288e8dab96e966b151d4d205846049f5b2819e97" -dependencies = [ - "proc-macro-crate", - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", ] [[package]] name = "ruma-client-api" -version = "0.12.3" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8acd3e66bf9d63d9472ecd17b9f497062ce1caaf13673b101d6697358b41a7" +checksum = "d1e72bc731b4dc8b569aa83915f13e419144b67110d858c65bb74aa05e2dc4b7" dependencies = [ "assign", "bytes", @@ -2523,168 +2641,77 @@ dependencies = [ "js_int", "maplit", "percent-encoding", - "ruma-api", "ruma-common", - "ruma-events", - "ruma-identifiers", - "ruma-serde", "serde", "serde_json", ] [[package]] name = "ruma-common" -version = "0.6.0" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d5b7605f58dc0d9cf1848cc7f1af2bae4e4bcd1d2b7a87bbb9864c8a785b91" +checksum = "716889595f4edc3cfeb94d9f122e413f73e37d7d80ea1c14196e1004241a3889" dependencies = [ + "base64 0.13.1", + "bytes", + "form_urlencoded", + "getrandom 0.2.8", + "http", "indexmap", + "itoa", + "js-sys", "js_int", - "ruma-identifiers", - "ruma-serde", + "js_option", + "percent-encoding", + "rand 0.8.5", + "regex", + "ruma-identifiers-validation", + "ruma-macros", "serde", "serde_json", + "thiserror", "tracing", + "url", + "uuid 1.3.0", "wildmatch", ] -[[package]] -name = "ruma-events" -version = "0.24.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba40ba9f4b6bdf6dc82b18ee7dfd7a029c86a12f9785a0efe4df04bd5dfa3c8" -dependencies = [ - "indoc", - "js_int", - "ruma-common", - "ruma-events-macros", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ruma-events-macros" -version = "0.24.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431a3dfadb48a8b7df9d00776274e32fed68df96cc19d9d9346bfed62540f91a" -dependencies = [ - "proc-macro-crate", - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", -] - [[package]] name = "ruma-federation-api" -version = "0.3.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa3d1db1a064ab26484df6ef5d96c384fc053022004f34d96c3b4939e13dc204" +checksum = "9f905d12f6144c7a754bd0339fa6893698c03d03a908abb20cc6eeb4ec7f9466" dependencies = [ "js_int", - "ruma-api", "ruma-common", - "ruma-events", - "ruma-identifiers", - "ruma-serde", "serde", "serde_json", ] -[[package]] -name = "ruma-identifiers" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb417d091e8dd5a633e4e5998231a156049d7fcc221045cfdc0642eb72067732" -dependencies = [ - "paste", - "ruma-identifiers-macros", - "ruma-identifiers-validation", - "ruma-serde", - "ruma-serde-macros", - "serde", -] - -[[package]] -name = "ruma-identifiers-macros" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c708edad7f605638f26c951cbad7501fbf28ab01009e5ca65ea5a2db74a882b1" -dependencies = [ - "quote 1.0.26", - "ruma-identifiers-validation", - "syn 1.0.109", -] - [[package]] name = "ruma-identifiers-validation" -version = "0.5.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42285e7fb5d5f2d5268e45bb683e36d5c6fd9fc1e11a4559ba3c3521f3bbb2cb" - -[[package]] -name = "ruma-serde" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2b22aae842e7ecda695e42b7b39d4558959d9d9a27acc2a16acf4f4f7f00c3" +checksum = "ebefdab34311af44d07cd2cd91c36cfe6a8c770647c6b00f6ab47f1186b2bb72" dependencies = [ - "bytes", - "form_urlencoded", - "itoa 0.4.8", "js_int", - "ruma-serde-macros", - "serde", - "serde_json", + "thiserror", ] [[package]] -name = "ruma-serde-macros" -version = "0.5.0" +name = "ruma-macros" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243e9bef188b08f94c79bc2f8fd1eb307a9e636b2b8e4571acf8c7be16381d28" +checksum = "0f82e91eb61cd86d9287303133ee55b54618eccb75a522cc22a42c15f5bda340" dependencies = [ + "once_cell", "proc-macro-crate", "proc-macro2 1.0.56", "quote 1.0.26", - "syn 1.0.109", -] - -[[package]] -name = "ruma-signatures" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a4f64027165b59500162d10d435b1253898bf3ad4f5002cb0d56913fe7f76d7" -dependencies = [ - "base64 0.13.1", - "ed25519-dalek", - "pkcs8", - "rand 0.7.3", - "ruma-identifiers", - "ruma-serde", - "serde_json", - "sha2 0.9.9", - "thiserror", - "tracing", -] - -[[package]] -name = "ruma-state-res" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518c1afbddfcc5ffac8818a5cf0902709e6eca11aca8f24f6479df6f0601f1ba" -dependencies = [ - "itertools 0.10.5", - "js_int", - "ruma-common", - "ruma-events", - "ruma-identifiers", - "ruma-serde", + "ruma-identifiers-validation", "serde", - "serde_json", - "thiserror", - "tracing", + "syn 1.0.109", + "toml", ] [[package]] @@ -2710,7 +2737,7 @@ checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ "base64 0.13.1", "blake2b_simd", - "constant_time_eq", + "constant_time_eq 0.1.5", "crossbeam-utils", ] @@ -2752,12 +2779,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - [[package]] name = "scopeguard" version = "1.1.0" @@ -2793,12 +2814,6 @@ dependencies = [ "libc", ] -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - [[package]] name = "serde" version = "1.0.159" @@ -2808,6 +2823,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.159" @@ -2825,7 +2849,7 @@ version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ - "itoa 1.0.6", + "itoa", "ryu", "serde", ] @@ -2837,7 +2861,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.6", + "itoa", "ryu", "serde", ] @@ -2902,7 +2926,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -2948,9 +2972,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.4.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c01a0c15da1b0b0e1494112e7af814a678fec9bd157881b49beac661e9b6f32" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" dependencies = [ "der", ] @@ -3000,7 +3024,7 @@ dependencies = [ "hashlink", "hex", "indexmap", - "itoa 1.0.6", + "itoa", "libc", "libsqlite3-sys", "log", @@ -3095,6 +3119,12 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.22.0" @@ -3122,7 +3152,7 @@ version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -3199,14 +3229,13 @@ dependencies = [ "fuse-rust", "futures", "html2text", - "indexmap", "indoc", "itertools 0.10.5", "log", "matrix-sdk", "nom 5.1.2", "phf", - "prost", + "prost 0.7.0", "rand 0.8.5", "refinery", "rust-argon2", @@ -3229,7 +3258,7 @@ dependencies = [ name = "tenebrous-rpc" version = "0.1.0" dependencies = [ - "prost", + "prost 0.7.0", "tonic", "tonic-build", ] @@ -3273,17 +3302,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiff" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" -dependencies = [ - "jpeg-decoder", - "miniz_oxide 0.4.4", - "weezl", -] - [[package]] name = "time" version = "0.1.45" @@ -3301,7 +3319,7 @@ version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ - "itoa 1.0.6", + "itoa", "serde", "time-core", "time-macros", @@ -3343,7 +3361,7 @@ version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ - "autocfg", + "autocfg 1.1.0", "bytes", "libc", "mio", @@ -3443,8 +3461,8 @@ dependencies = [ "hyper", "percent-encoding", "pin-project", - "prost", - "prost-derive", + "prost 0.7.0", + "prost-derive 0.7.0", "tokio", "tokio-stream", "tokio-util 0.6.10", @@ -3669,6 +3687,15 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "uuid" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" +dependencies = [ + "rand 0.6.5", +] + [[package]] name = "uuid" version = "0.8.2" @@ -3676,7 +3703,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ "getrandom 0.2.8", - "serde", +] + +[[package]] +name = "uuid" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +dependencies = [ + "getrandom 0.2.8", + "wasm-bindgen", ] [[package]] @@ -3697,6 +3733,31 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vodozemac" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f20153a1c82ac5f1243b62e80f067ae608facc415c6ef82f88426a61c79886" +dependencies = [ + "aes", + "arrayvec 0.7.2", + "base64 0.13.1", + "cbc", + "ed25519-dalek", + "hkdf", + "hmac", + "pkcs7", + "prost 0.11.8", + "rand 0.7.3", + "serde", + "serde_json", + "sha2 0.10.6", + "subtle", + "thiserror", + "x25519-dalek", + "zeroize", +] + [[package]] name = "walkdir" version = "2.3.3" @@ -3742,6 +3803,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -3801,6 +3864,21 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.61" @@ -3811,12 +3889,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "weezl" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" - [[package]] name = "which" version = "4.4.0" @@ -4030,6 +4102,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "x25519-dalek" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077" +dependencies = [ + "curve25519-dalek", + "rand_core 0.5.1", + "serde", + "zeroize", +] + [[package]] name = "xml5ever" version = "0.16.2" diff --git a/dicebot/Cargo.toml b/dicebot/Cargo.toml index 3f8bdee..2a7d817 100644 --- a/dicebot/Cargo.toml +++ b/dicebot/Cargo.toml @@ -16,7 +16,7 @@ tonic-build = "0.4" [dependencies] # indexmap version locked fixes a dependency cycle. -indexmap = "=1.6.2" +# indexmap = "=1.6.2" log = "0.4" tracing-subscriber = "0.2" toml = "0.5" @@ -33,7 +33,7 @@ combine = "4.5" futures = "0.3" html2text = "0.2" phf = { version = "0.8", features = ["macros"] } -matrix-sdk = { version = "0.4.1" } +matrix-sdk = { version = "0.6" } refinery = { version = "0.8", features = ["rusqlite"]} barrel = { version = "0.7", features = ["sqlite3"] } strum = { version = "0.22", features = ["derive"] } diff --git a/dicebot/src/bin/dicebot-cmd.rs b/dicebot/src/bin/dicebot-cmd.rs index e264ce2..70d6466 100644 --- a/dicebot/src/bin/dicebot-cmd.rs +++ b/dicebot/src/bin/dicebot-cmd.rs @@ -1,4 +1,4 @@ -use matrix_sdk::ruma::identifiers::room_id; +use matrix_sdk::ruma::room_id; use matrix_sdk::Client; use tenebrous_dicebot::commands; use tenebrous_dicebot::commands::ResponseExtractor; @@ -29,7 +29,7 @@ async fn main() -> Result<(), BotError> { let context = Context { db, account: Account::default(), - matrix_client: Client::new(homeserver).expect("Could not create matrix client"), + matrix_client: Client::new(homeserver).await.expect("Could not create matrix client"), origin_room: RoomContext { id: &room_id!("!fakeroomid:example.com"), display_name: "fake room".to_owned(), diff --git a/dicebot/src/bin/dicebot.rs b/dicebot/src/bin/dicebot.rs index a1d488c..21ab021 100644 --- a/dicebot/src/bin/dicebot.rs +++ b/dicebot/src/bin/dicebot.rs @@ -21,7 +21,7 @@ async fn init(config_path: &str) -> Result<(Arc, Database, Client), BotE let cfg = Arc::new(cfg); let sqlite_path = format!("{}/dicebot.sqlite", cfg.database_path()); let db = Database::new(&sqlite_path).await?; - let client = tenebrous_dicebot::matrix::create_client(&cfg)?; + let client = tenebrous_dicebot::matrix::create_client(&cfg).await?; Ok((cfg, db, client)) } @@ -55,7 +55,7 @@ async fn run() -> Result<(), BotError> { match try_join!(bot, grpc) { Ok(_) => (), - Err(e) => error!("Error: {}", e), + Err(e) => error!("Error: {:?}", e), }; Ok(()) diff --git a/dicebot/src/bot/command_execution.rs b/dicebot/src/bot/command_execution.rs index 59f26f2..f9484e9 100644 --- a/dicebot/src/bot/command_execution.rs +++ b/dicebot/src/bot/command_execution.rs @@ -8,7 +8,7 @@ use crate::{ models::Account, }; use futures::stream::{self, StreamExt}; -use matrix_sdk::ruma::{EventId, RoomId}; +use matrix_sdk::ruma::{OwnedEventId, RoomId}; use matrix_sdk::{self, room::Joined, Client}; use std::clone::Clone; use std::convert::TryFrom; @@ -20,7 +20,7 @@ pub(super) async fn handle_single_result( cmd_result: &ExecutionResult, respond_to: &str, room: &Joined, - event_id: EventId, + event_id: OwnedEventId, ) { let html = cmd_result.message_html(respond_to); let plain = cmd_result.message_plain(respond_to); @@ -108,9 +108,9 @@ fn get_account_active_room(client: &Client, account: &Account) -> Result::try_from(room_id)) .transpose()? - .and_then(|active_room_id| client.get_joined_room(&active_room_id)); + .and_then(|active_room_id| client.get_joined_room(active_room_id)); Ok(active_room) } diff --git a/dicebot/src/bot/event_handlers.rs b/dicebot/src/bot/event_handlers.rs index 7e4017c..03b0b5a 100644 --- a/dicebot/src/bot/event_handlers.rs +++ b/dicebot/src/bot/event_handlers.rs @@ -3,25 +3,24 @@ use crate::db::sqlite::Database; use crate::db::Rooms; use crate::error::BotError; use log::{debug, error, info, warn}; -use matrix_sdk::ruma::events::room::member::MemberEventContent; -use matrix_sdk::ruma::events::room::message::{MessageType, TextMessageEventContent}; -use matrix_sdk::ruma::events::{StrippedStateEvent, SyncMessageEvent}; -use matrix_sdk::Client; -use matrix_sdk::{self, room::Room, ruma::events::room::message::MessageEventContent}; +use matrix_sdk::ruma::events::room::member::RoomMemberEventContent; +use matrix_sdk::ruma::events::{StrippedStateEvent, SyncMessageLikeEvent}; +use matrix_sdk::{Client, DisplayName}; +use matrix_sdk::{self, room::Room, ruma::events::room::message::RoomMessageEventContent}; use std::ops::Sub; use std::time::{Duration, SystemTime}; -use std::{clone::Clone, time::UNIX_EPOCH}; +use std::time::UNIX_EPOCH; /// Check if a message is recent enough to actually process. If the /// message is within "oldest_message_age" seconds, this function /// returns true. If it's older than that, it returns false and logs a /// debug message. fn check_message_age( - event: &SyncMessageEvent, + event: &SyncMessageLikeEvent, oldest_message_age: u64, ) -> bool { let sending_time = event - .origin_server_ts + .origin_server_ts() .to_system_time() .unwrap_or(UNIX_EPOCH); @@ -48,7 +47,7 @@ fn check_message_age( /// the bot left and rejoined quickly. async fn should_process_message<'a>( bot: &DiceBot, - event: &SyncMessageEvent, + event: &SyncMessageLikeEvent, ) -> Result<(String, String), BotError> { //Ignore messages that are older than configured duration. if !check_message_age(event, bot.config.oldest_message_age()) { @@ -62,23 +61,13 @@ async fn should_process_message<'a>( return Err(BotError::ShouldNotProcessError); } - let (msg_body, sender_username) = if let SyncMessageEvent { - content: - MessageEventContent { - msgtype: MessageType::Text(TextMessageEventContent { body, .. }), - .. - }, - sender, - .. - } = event - { - ( - body.clone(), - format!("@{}:{}", sender.localpart(), sender.server_name()), - ) - } else { - (String::new(), String::new()) - }; + let msg_body: String = event + .as_original() + .map(|e| e.content.body()) + .map(str::to_string) + .unwrap_or_else(|| String::new()); + + let sender_username: String = format!("@{}:{}", event.sender().localpart(), event.sender().server_name()); Ok((msg_body, sender_username)) } @@ -96,7 +85,7 @@ async fn should_process_event(db: &Database, room_id: &str, event_id: &str) -> b } pub(super) async fn on_stripped_state_member( - event: StrippedStateEvent, + event: StrippedStateEvent, client: Client, room: Room, ) { @@ -111,7 +100,7 @@ pub(super) async fn on_stripped_state_member( info!( "Autojoining room {}", - room.display_name().await.ok().unwrap_or_default() + room.display_name().await.ok().unwrap_or_else(|| DisplayName::Named("[error]".to_string())) ); if let Err(e) = client.join_room_by_id(&room.room_id()).await { @@ -120,7 +109,7 @@ pub(super) async fn on_stripped_state_member( } pub(super) async fn on_room_message( - event: SyncMessageEvent, + event: SyncMessageLikeEvent, room: Room, bot: DiceBot, ) { @@ -130,7 +119,7 @@ pub(super) async fn on_room_message( }; let room_id = room.room_id().as_str(); - if !should_process_event(&bot.db, room_id, event.event_id.as_str()).await { + if !should_process_event(&bot.db, room_id, event.event_id().as_str()).await { return; } @@ -145,6 +134,6 @@ pub(super) async fn on_room_message( .execute_commands(&room, &sender_username, &msg_body) .await; - bot.handle_results(&room, &sender_username, event.event_id.clone(), results) + bot.handle_results(&room, &sender_username, event.event_id().to_owned(), results) .await; } diff --git a/dicebot/src/bot/mod.rs b/dicebot/src/bot/mod.rs index 57fb57d..03029ee 100644 --- a/dicebot/src/bot/mod.rs +++ b/dicebot/src/bot/mod.rs @@ -6,10 +6,11 @@ use crate::error::BotError; use crate::state::DiceBotState; use log::info; use matrix_sdk::room::Room; -use matrix_sdk::ruma::events::room::message::MessageEventContent; -use matrix_sdk::ruma::events::SyncMessageEvent; -use matrix_sdk::ruma::EventId; -use matrix_sdk::{self, room::Joined, Client, SyncSettings}; +use matrix_sdk::ruma::events::room::message::RoomMessageEventContent; +use matrix_sdk::ruma::events::SyncMessageLikeEvent; +use matrix_sdk::ruma::OwnedEventId; +use matrix_sdk::{self, room::Joined, Client}; +use matrix_sdk::config::SyncSettings; use std::clone::Clone; use std::sync::{Arc, RwLock}; @@ -68,12 +69,14 @@ impl DiceBot { let device_id: Option = self.db.get_device_id().await?; let device_id: Option<&str> = device_id.as_deref(); - client - .login(username, password, device_id, Some("matrix dice bot")) - .await?; + let no_device_ld_login = || client.login_username(username, password); + let device_id_login = |id| client.login_username(username, password).device_id(id); + let login = device_id.map_or_else(no_device_ld_login, device_id_login); + + login.send().await?; if device_id.is_none() { - let device_id = client.device_id().await.ok_or(BotError::NoDeviceIdFound)?; + let device_id = client.device_id().ok_or(BotError::NoDeviceIdFound)?; self.db.set_device_id(device_id.as_str()).await?; info!("Recorded new device ID: {}", device_id.as_str()); } else { @@ -87,19 +90,17 @@ impl DiceBot { async fn bind_events(&self) { //on room message: need closure to pass bot ref in. self.client - .register_event_handler({ + .add_event_handler({ let bot: DiceBot = self.clone(); - move |event: SyncMessageEvent, room: Room| { + move |event: SyncMessageLikeEvent, room: Room| { let bot = bot.clone(); async move { event_handlers::on_room_message(event, room, bot).await } } - }) - .await; + }); //auto-join handler self.client - .register_event_handler(event_handlers::on_stripped_state_member) - .await; + .add_event_handler(event_handlers::on_stripped_state_member); } /// Logs the bot in to Matrix and listens for events until program @@ -114,7 +115,7 @@ impl DiceBot { // TODO replace with sync_with_callback for cleaner shutdown // process. - client.sync(SyncSettings::default()).await; + client.sync(SyncSettings::default()).await?; Ok(()) } @@ -144,7 +145,7 @@ impl DiceBot { &self, room: &Joined, sender_username: &str, - event_id: EventId, + event_id: OwnedEventId, results: Vec<(String, ExecutionResult)>, ) { if results.len() >= 1 { diff --git a/dicebot/src/cofd/dice.rs b/dicebot/src/cofd/dice.rs index 4300ebc..bd64c4d 100644 --- a/dicebot/src/cofd/dice.rs +++ b/dicebot/src/cofd/dice.rs @@ -332,7 +332,7 @@ mod tests { macro_rules! dummy_room { () => { crate::context::RoomContext { - id: &matrix_sdk::ruma::identifiers::room_id!("!fakeroomid:example.com"), + id: &matrix_sdk::ruma::room_id!("!fakeroomid:example.com"), display_name: "displayname".to_owned(), secure: false, } @@ -485,7 +485,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", @@ -527,7 +527,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", @@ -566,7 +566,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db.clone(), - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", diff --git a/dicebot/src/commands/mod.rs b/dicebot/src/commands/mod.rs index ba9ffeb..2a4f7f0 100644 --- a/dicebot/src/commands/mod.rs +++ b/dicebot/src/commands/mod.rs @@ -162,11 +162,12 @@ mod tests { use super::*; use management::RegisterCommand; use url::Url; + use matrix_sdk::ruma::room_id; macro_rules! dummy_room { () => { crate::context::RoomContext { - id: &matrix_sdk::ruma::identifiers::room_id!("!fakeroomid:example.com"), + id: &room_id!("!fakeroomid:example.com"), display_name: "displayname".to_owned(), secure: false, } @@ -176,7 +177,7 @@ mod tests { macro_rules! secure_room { () => { crate::context::RoomContext { - id: &matrix_sdk::ruma::identifiers::room_id!("!fakeroomid:example.com"), + id: &room_id!("!fakeroomid:example.com"), display_name: "displayname".to_owned(), secure: true, } @@ -195,7 +196,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: secure_room!(), active_room: secure_room!(), username: "myusername", @@ -218,7 +219,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: secure_room!(), active_room: secure_room!(), username: "myusername", @@ -241,7 +242,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "myusername", @@ -264,7 +265,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "myusername", @@ -287,7 +288,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "myusername", diff --git a/dicebot/src/commands/rooms.rs b/dicebot/src/commands/rooms.rs index 1720b72..a0ca2df 100644 --- a/dicebot/src/commands/rooms.rs +++ b/dicebot/src/commands/rooms.rs @@ -6,7 +6,7 @@ use crate::matrix; use async_trait::async_trait; use fuse_rust::{Fuse, FuseProperty, Fuseable}; use futures::stream::{self, StreamExt, TryStreamExt}; -use matrix_sdk::{ruma::UserId, Client}; +use matrix_sdk::{ruma::OwnedUserId, Client}; use std::convert::TryFrom; /// Holds matrix room ID and display name as strings, for use with @@ -62,13 +62,13 @@ async fn get_rooms_for_user( client: &Client, user_id: &str, ) -> Result, BotError> { - let user_id = UserId::try_from(user_id)?; + let user_id = OwnedUserId::try_from(user_id)?; let rooms_for_user = matrix::get_rooms_for_user(client, &user_id).await?; let mut rooms_for_user: Vec = stream::iter(rooms_for_user) .filter_map(|room| async move { Some(room.display_name().await.map(|room_name| RoomNameAndId { id: room.room_id().to_string(), - name: room_name, + name: room_name.to_string(), })) }) .try_collect() diff --git a/dicebot/src/context.rs b/dicebot/src/context.rs index 105738e..a8cdabb 100644 --- a/dicebot/src/context.rs +++ b/dicebot/src/context.rs @@ -2,7 +2,7 @@ use crate::db::sqlite::Database; use crate::error::BotError; use crate::models::Account; use matrix_sdk::room::Joined; -use matrix_sdk::ruma::identifiers::{RoomId, UserId}; +use matrix_sdk::ruma::{RoomId, UserId}; use matrix_sdk::Client; use std::convert::TryFrom; @@ -48,15 +48,16 @@ impl RoomContext<'_> { // TODO is_direct is a hack; the bot should set eligible rooms // to Direct Message upon joining, if other contact has // requested it. Waiting on SDK support. - let display_name = room + let display_name = + room .display_name() .await .ok() - .unwrap_or_default() - .to_string(); + .map(|d| d.to_string()) + .unwrap_or_default(); - let sending_user = UserId::try_from(sending_user)?; - let user_in_room = room.get_member(&sending_user).await.ok().is_some(); + let sending_user = <&UserId>::try_from(sending_user)?; + let user_in_room = room.get_member(sending_user).await.ok().is_some(); let is_direct = room.active_members().await?.len() == 2; Ok(RoomContext { diff --git a/dicebot/src/cthulhu/dice.rs b/dicebot/src/cthulhu/dice.rs index 827389b..e123d73 100644 --- a/dicebot/src/cthulhu/dice.rs +++ b/dicebot/src/cthulhu/dice.rs @@ -270,7 +270,7 @@ macro_rules! is_variable { element: Element::Variable(_), .. } - ); + ) }; } @@ -427,11 +427,12 @@ mod tests { use crate::db::sqlite::Database; use crate::parser::dice::{Amount, Element, Operator}; use url::Url; + use matrix_sdk::ruma::room_id; macro_rules! dummy_room { () => { crate::context::RoomContext { - id: &matrix_sdk::ruma::identifiers::room_id!("!fakeroomid:example.com"), + id: &room_id!("!fakeroomid:example.com"), display_name: "displayname".to_owned(), secure: false, } @@ -511,7 +512,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", @@ -549,7 +550,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", @@ -587,7 +588,7 @@ mod tests { let ctx = Context { account: crate::models::Account::default(), db: db, - matrix_client: matrix_sdk::Client::new(homeserver).unwrap(), + matrix_client: matrix_sdk::Client::new(homeserver).await.unwrap(), origin_room: dummy_room!(), active_room: dummy_room!(), username: "username", diff --git a/dicebot/src/error.rs b/dicebot/src/error.rs index f4728a5..9b7751e 100644 --- a/dicebot/src/error.rs +++ b/dicebot/src/error.rs @@ -18,6 +18,12 @@ pub enum BotError { #[error("could not retrieve device id")] NoDeviceIdFound, + #[error("could not build client: {0}")] + ClientBuildError(#[from] matrix_sdk::ClientBuildError), + + #[error("could not open matrix store: {0}")] + OpenStoreError(#[from] matrix_sdk::store::OpenStoreError), + #[error("command error: {0}")] CommandError(#[from] CommandError), @@ -33,6 +39,9 @@ pub enum BotError { #[error("could not parse URL")] UrlParseError(#[from] url::ParseError), + #[error("could not parse ID")] + IdParseError(#[from] matrix_sdk::ruma::IdParseError), + #[error("error in matrix state store: {0}")] MatrixStateStoreError(#[from] matrix_sdk::StoreError), @@ -76,8 +85,8 @@ pub enum BotError { #[error("could not convert to proper integer type")] TryFromIntError(#[from] std::num::TryFromIntError), - #[error("identifier error: {0}")] - IdentifierError(#[from] matrix_sdk::ruma::identifiers::Error), + // #[error("identifier error: {0}")] + // IdentifierError(#[from] matrix_sdk::ruma::Error), #[error("password creation error: {0}")] PasswordCreationError(argon2::Error), diff --git a/dicebot/src/matrix.rs b/dicebot/src/matrix.rs index bd4a0c6..c99b267 100644 --- a/dicebot/src/matrix.rs +++ b/dicebot/src/matrix.rs @@ -2,12 +2,12 @@ use std::path::PathBuf; use futures::stream::{self, StreamExt, TryStreamExt}; use log::error; -use matrix_sdk::ruma::events::room::message::{InReplyTo, MessageEventContent, Relation}; -use matrix_sdk::ruma::events::AnyMessageEventContent; -use matrix_sdk::ruma::{EventId, RoomId, UserId}; +use matrix_sdk::ruma::events::room::message::{InReplyTo, RoomMessageEventContent, Relation}; +use matrix_sdk::ruma::events::AnyMessageLikeEventContent; +use matrix_sdk::ruma::{RoomId, OwnedEventId, OwnedUserId}; use matrix_sdk::Client; use matrix_sdk::Error as MatrixError; -use matrix_sdk::{room::Joined, ClientConfig}; +use matrix_sdk::room::Joined; use url::Url; use crate::{config::Config, error::BotError}; @@ -29,12 +29,16 @@ fn extract_error_message(error: MatrixError) -> String { } /// Creates the matrix client. -pub fn create_client(config: &Config) -> Result { +pub async fn create_client(config: &Config) -> Result { let cache_dir = cache_dir()?; - let client_config = ClientConfig::new().store_path(cache_dir); let homeserver_url = Url::parse(&config.matrix_homeserver())?; - Ok(Client::new_with_config(homeserver_url, client_config)?) + let client = Client::builder() + .sled_store(cache_dir, None)? + .homeserver_url(homeserver_url).build() + .await?; + + Ok(client) } /// Retrieve a list of users in a given room. @@ -56,7 +60,7 @@ pub async fn get_users_in_room( pub async fn get_rooms_for_user( client: &Client, - user: &UserId, + user: &OwnedUserId, ) -> Result, MatrixError> { // Carries errors through, in case we cannot load joined user IDs // from the room for some reason. @@ -84,7 +88,7 @@ pub async fn send_message( client: &Client, room_id: &RoomId, message: (&str, &str), - reply_to: Option, + reply_to: Option, ) { let (html, plain) = message; let room = match client.get_joined_room(room_id) { @@ -92,13 +96,13 @@ pub async fn send_message( _ => return, }; - let mut content = MessageEventContent::notice_html(plain.trim(), html); + let mut content = RoomMessageEventContent::notice_html(plain.trim(), html); content.relates_to = reply_to.map(|event_id| Relation::Reply { - in_reply_to: InReplyTo::new(event_id), + in_reply_to: InReplyTo::new(event_id) }); - let content = AnyMessageEventContent::RoomMessage(content); + let content = AnyMessageLikeEventContent::RoomMessage(content); let result = room.send(content, None).await; diff --git a/dicebot/src/rpc/service.rs b/dicebot/src/rpc/service.rs index 186d3d2..28105c6 100644 --- a/dicebot/src/rpc/service.rs +++ b/dicebot/src/rpc/service.rs @@ -4,7 +4,7 @@ use crate::matrix; use crate::{config::Config, db::sqlite::Database}; use futures::stream; use futures::{StreamExt, TryFutureExt, TryStreamExt}; -use matrix_sdk::ruma::UserId; +use matrix_sdk::ruma::OwnedUserId; use matrix_sdk::{room::Joined, Client}; use std::convert::TryFrom; use std::sync::Arc; @@ -85,7 +85,7 @@ impl Dicebot for DicebotRpcService { request: Request, ) -> Result, Status> { let UserIdRequest { user_id } = request.into_inner(); - let user_id = UserId::try_from(user_id).map_err(BotError::from)?; + let user_id = OwnedUserId::try_from(user_id).map_err(BotError::from)?; let rooms_for_user = matrix::get_rooms_for_user(&self.client, &user_id) .err_into::() @@ -95,7 +95,7 @@ impl Dicebot for DicebotRpcService { .filter_map(|room: Joined| async move { let room: Result = room.display_name().await.map(|room_name| Room { room_id: room.room_id().to_string(), - display_name: room_name, + display_name: room_name.to_string(), }); Some(room)