From e423745a2c55d9deaa63033758339fac540bd850 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 29 Mar 2024 02:03:27 +0800 Subject: [PATCH] remove matrix support, use tailchat 0.6.0-dev --- Cargo.lock | 1028 +-------------------------------- ica-rs/Cargo.toml | 17 +- ica-rs/ica_typing.py | 3 - ica-rs/src/config.rs | 40 +- ica-rs/src/error.rs | 34 -- ica-rs/src/ica/events.rs | 8 +- ica-rs/src/main.rs | 21 +- ica-rs/src/matrix.rs | 140 ----- ica-rs/src/matrix/events.rs | 42 -- ica-rs/src/py/call.rs | 23 +- ica-rs/src/py/class.rs | 1 - ica-rs/src/py/class/ica.rs | 2 - ica-rs/src/py/class/matrix.rs | 1 - ica-rs/src/status.rs | 24 - news.md | 10 + 15 files changed, 54 insertions(+), 1340 deletions(-) delete mode 100644 ica-rs/src/matrix.rs delete mode 100644 ica-rs/src/matrix/events.rs delete mode 100644 ica-rs/src/py/class/matrix.rs diff --git a/Cargo.lock b/Cargo.lock index a5299c7..9d6a555 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,25 +23,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -66,63 +47,6 @@ dependencies = [ "backtrace", ] -[[package]] -name = "anymap2" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" - -[[package]] -name = "aquamarine" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" -dependencies = [ - "include_dir", - "itertools", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.52", -] - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "as_variant" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38fa22307249f86fb7fad906fcae77f2564caeb56d7209103c551cd1cf4798f" - -[[package]] -name = "assign" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002" - -[[package]] -name = "async-channel" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" -dependencies = [ - "concurrent-queue", - "event-listener 5.2.0", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-stream" version = "0.3.5" @@ -142,7 +66,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -153,7 +77,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -168,12 +92,9 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ - "futures-core", "getrandom", "instant", - "pin-project-lite", "rand", - "tokio", ] [[package]] @@ -215,25 +136,6 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" -[[package]] -name = "bitmaps" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d084b0137aaa901caf9f1e8b21daa6aa24d41cd806e111335541eff9683bd6" - -[[package]] -name = "blake3" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -261,12 +163,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "bytesize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" - [[package]] name = "cc" version = "1.0.90" @@ -279,42 +175,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg-vis" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a2c3bf5fc10fe2ca157564fbe08a4cb2b0a7d2ff3fe2f9683e65d5e7c7859c" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - [[package]] name = "chrono" version = "0.4.35" @@ -329,17 +189,6 @@ dependencies = [ "windows-targets 0.52.4", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - [[package]] name = "colored" version = "2.1.0" @@ -350,33 +199,12 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "concurrent-queue" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "const-oid" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "const_panic" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - [[package]] name = "core-foundation" version = "0.9.4" @@ -402,12 +230,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - [[package]] name = "crypto-common" version = "0.1.6" @@ -415,7 +237,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core", "typenum", ] @@ -444,7 +265,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -480,18 +301,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", ] [[package]] @@ -518,12 +327,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "either" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" - [[package]] name = "encoding_rs" version = "0.8.33" @@ -549,62 +352,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" -dependencies = [ - "event-listener 5.2.0", - "pin-project-lite", -] - -[[package]] -name = "eyeball" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42482893d982111055ce4b24234d6250396d3785767c6b04cedd84612a0b80fb" -dependencies = [ - "futures-core", - "readlock", - "tracing", -] - -[[package]] -name = "eyeball-im" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021fab29d9670be5867b16d56a95c29a12c3c1bb654e7d589010a028716d625d" -dependencies = [ - "futures-core", - "imbl", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "fastrand" version = "2.0.1" @@ -676,7 +423,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -697,7 +444,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -736,18 +482,6 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -[[package]] -name = "gloo-timers" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "h2" version = "0.3.25" @@ -791,15 +525,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "http" version = "0.2.12" @@ -858,20 +583,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - [[package]] name = "hyper-tls" version = "0.5.0" @@ -910,7 +621,7 @@ dependencies = [ [[package]] name = "ica-rs" -version = "0.5.3" +version = "0.6.0-dev" dependencies = [ "anyhow", "chrono", @@ -919,7 +630,7 @@ dependencies = [ "ed25519-dalek", "futures-util", "hex", - "matrix-sdk", + "md-5", "pyo3", "rust_socketio", "serde", @@ -928,7 +639,6 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "url", ] [[package]] @@ -941,48 +651,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "imbl" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978d142c8028edf52095703af2fad11d6f611af1246685725d6b850634647085" -dependencies = [ - "bitmaps", - "imbl-sized-chunks", - "rand_core", - "rand_xoshiro", - "serde", - "version_check", -] - -[[package]] -name = "imbl-sized-chunks" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "144006fb58ed787dcae3f54575ff4349755b00ccc99f4b4873860b654be1ed63" -dependencies = [ - "bitmaps", -] - -[[package]] -name = "include_dir" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" -dependencies = [ - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "indexmap" version = "2.2.5" @@ -991,7 +659,6 @@ checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", - "serde", ] [[package]] @@ -1000,15 +667,6 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - [[package]] name = "instant" version = "0.1.12" @@ -1024,15 +682,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.10" @@ -1048,44 +697,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "js_int" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d937f95470b270ce8b8950207715d71aa8e153c0d44c6684d59397ed4949160a" -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 = "konst" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d712a8c49d4274f8d8a5cf61368cb5f3c143d149882b1a2918129e53395fdb0" -dependencies = [ - "const_panic", - "konst_kernel", - "typewit", -] - -[[package]] -name = "konst_kernel" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac6ea8c376b6e208a81cf39b8e82bebf49652454d98a4829e907dac16ef1790" -dependencies = [ - "typewit", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1121,119 +732,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] -name = "maplit" -version = "1.0.2" +name = "md-5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "matrix-sdk" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336687e5fc8b33661a31681e988a67e9a3090c7fb1a8323a7f71eeaabad642ec" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "anymap2", - "aquamarine", - "as_variant", - "async-channel", - "async-stream", - "async-trait", - "backoff", - "bytes", - "bytesize", - "cfg-vis", - "event-listener 4.0.3", - "eyeball", - "eyeball-im", - "futures-core", - "futures-util", - "gloo-timers", - "http", - "imbl", - "indexmap", - "matrix-sdk-base", - "matrix-sdk-common", - "mime", - "mime2ext", - "reqwest", - "ruma", - "serde", - "serde_html_form", - "serde_json", - "tempfile", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", - "url", - "urlencoding", - "zeroize", -] - -[[package]] -name = "matrix-sdk-base" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00891954d0826a94f1d130f46cbca64176003a234c1be5d9d282970d31cf0c87" -dependencies = [ - "as_variant", - "async-trait", - "bitflags 2.4.2", - "eyeball", - "eyeball-im", - "futures-util", - "matrix-sdk-common", - "matrix-sdk-store-encryption", - "once_cell", - "ruma", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "matrix-sdk-common" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb365a626ab6f6c6a2422cfe2565522f19accb06706c6d04bca8f0f71df29c9f" -dependencies = [ - "async-trait", - "futures-core", - "futures-util", - "gloo-timers", - "instant", - "ruma", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-subscriber", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "matrix-sdk-store-encryption" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a7e3162e9f982a4c57ab46df01a4775f697dec8899738bf62d7e97b63faa61c" -dependencies = [ - "blake3", - "chacha20poly1305", - "displaydoc", - "hmac", - "pbkdf2", - "rand", - "rmp-serde", - "serde", - "serde_json", - "sha2", - "thiserror", - "zeroize", + "cfg-if", + "digest", ] [[package]] @@ -1257,12 +762,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime2ext" -version = "0.1.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a85a5069ebd40e64b1985773cc81addbe9d90d7ecf60e7b5475a57ad584c70" - [[package]] name = "miniz_oxide" version = "0.7.2" @@ -1351,12 +850,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "openssl" version = "0.10.64" @@ -1380,7 +873,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1407,12 +900,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" - [[package]] name = "parking_lot" version = "0.12.1" @@ -1436,22 +923,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -1492,17 +963,6 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - [[package]] name = "portable-atomic" version = "1.6.0" @@ -1521,49 +981,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.79" @@ -1620,7 +1037,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1633,7 +1050,7 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -1675,21 +1092,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core", -] - -[[package]] -name = "readlock" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7b323e7196daa571c8584de958be19e92941c41f845776fe06babfe8fa280a2" - [[package]] name = "redox_syscall" version = "0.4.1" @@ -1699,35 +1101,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - [[package]] name = "reqwest" version = "0.11.26" @@ -1743,7 +1116,6 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -1753,7 +1125,6 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", "rustls-pemfile", "serde", "serde_json", @@ -1762,7 +1133,6 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1770,172 +1140,9 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots", "winreg", ] -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rmp" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" -dependencies = [ - "byteorder", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - -[[package]] -name = "ruma" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2779c38df072964c63476259d9300efb07d0d1a7178c6469893636ce0c547a36" -dependencies = [ - "assign", - "js_int", - "js_option", - "ruma-client-api", - "ruma-common", - "ruma-events", - "ruma-federation-api", -] - -[[package]] -name = "ruma-client-api" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641837258fa214a70823477514954ef0f5d3bc6ae8e1d5d85081856a33103386" -dependencies = [ - "assign", - "bytes", - "http", - "js_int", - "js_option", - "maplit", - "ruma-common", - "ruma-events", - "serde", - "serde_html_form", - "serde_json", -] - -[[package]] -name = "ruma-common" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bca4c33c50e47b4cdceeac71bdef0c04153b0e29aa992d9030ec14a62323e85" -dependencies = [ - "as_variant", - "base64", - "bytes", - "form_urlencoded", - "http", - "indexmap", - "js_int", - "konst", - "percent-encoding", - "rand", - "regex", - "ruma-identifiers-validation", - "ruma-macros", - "serde", - "serde_html_form", - "serde_json", - "thiserror", - "tracing", - "url", - "uuid", - "wildmatch", -] - -[[package]] -name = "ruma-events" -version = "0.27.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20a52770e5a9fb30b7a1c14ba8b3dcf76dadc01674e58e40094f78e6bd5e3f1" -dependencies = [ - "as_variant", - "indexmap", - "js_int", - "js_option", - "percent-encoding", - "regex", - "ruma-common", - "ruma-identifiers-validation", - "ruma-macros", - "serde", - "serde_json", - "thiserror", - "tracing", - "url", - "wildmatch", -] - -[[package]] -name = "ruma-federation-api" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1901c1f27bc327652d58af2a130c73acef3198abeccd24cee97f7267fdf3fe7" -dependencies = [ - "js_int", - "ruma-common", - "ruma-events", - "serde", - "serde_json", -] - -[[package]] -name = "ruma-identifiers-validation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8ad1259274f2f57c20901bd1cc5e4a8f23169d1c1d887b6338b02f058e9b41" -dependencies = [ - "js_int", - "thiserror", -] - -[[package]] -name = "ruma-macros" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0280534a4b3e34416f883285fac4f9c408cd0b737890ae66f3e7a7056d14be80" -dependencies = [ - "once_cell", - "proc-macro-crate 2.0.0", - "proc-macro2", - "quote", - "ruma-identifiers-validation", - "serde", - "syn 2.0.52", - "toml", -] - [[package]] name = "rust_engineio" version = "0.4.4" @@ -2009,18 +1216,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.21.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" -dependencies = [ - "log", - "ring", - "rustls-webpki", - "sct", -] - [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -2030,16 +1225,6 @@ dependencies = [ "base64", ] -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "ryu" version = "1.0.17" @@ -2061,16 +1246,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -2117,20 +1292,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", -] - -[[package]] -name = "serde_html_form" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50437e6a58912eecc08865e35ea2e8d365fbb2db0debb1c8bb43bf1faf055f25" -dependencies = [ - "form_urlencoded", - "indexmap", - "itoa", - "ryu", - "serde", + "syn", ] [[package]] @@ -2239,12 +1401,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "spki" version = "0.7.3" @@ -2261,17 +1417,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.52" @@ -2345,7 +1490,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -2406,9 +1551,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -2431,7 +1576,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -2444,28 +1589,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", - "tokio-util", -] - [[package]] name = "tokio-tungstenite" version = "0.20.1" @@ -2503,7 +1626,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.7", + "toml_edit", ] [[package]] @@ -2515,28 +1638,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.7" @@ -2547,7 +1648,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.5", + "winnow", ] [[package]] @@ -2575,7 +1676,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -2646,21 +1747,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "typewit" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" -dependencies = [ - "typewit_proc_macros", -] - -[[package]] -name = "typewit_proc_macros" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2688,22 +1774,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - [[package]] name = "url" version = "2.5.0" @@ -2715,27 +1785,12 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "utf-8" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "uuid" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" -dependencies = [ - "getrandom", -] - [[package]] name = "valuable" version = "0.1.0" @@ -2790,7 +1845,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-shared", ] @@ -2824,7 +1879,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2858,18 +1913,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "wildmatch" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "939e59c1bc731542357fdaad98b209ef78c8743d652bb61439d16b16a79eb025" - [[package]] name = "winapi" version = "0.3.9" @@ -3033,15 +2076,6 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.5" @@ -3066,17 +2100,3 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index 5887a02..97f14bb 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -1,25 +1,26 @@ [package] name = "ica-rs" -version = "0.5.3" +version = "0.6.0-dev" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["ica", "matrix"] +default = ["ica", "tailchat"] ica = ["dep:ed25519", "dep:ed25519-dalek", "dep:hex", "dep:rust_socketio"] -matrix = ["dep:matrix-sdk", "dep:url"] +tailchat = ["dep:rust_socketio", "dep:md-5"] [dependencies] -# matrix -url = { version = "2.5.0", optional = true } -matrix-sdk = { version = "0.7.1", optional = true, default-features = false, features = ["rustls-tls"] } - # ica ed25519 = { version = "2.2.3", optional = true } ed25519-dalek = { version = "2.1.1", optional = true } hex = { version = "0.4.3", optional = true } + +# tailchat +md-5 = { version = "0.10.6", optional = true } + +# ica & tailchat (socketio) rust_socketio = { version = "0.4.4", features = ["async"], optional = true } # data @@ -30,7 +31,7 @@ toml = "0.8.11" colored = "2.1.0" # runtime -tokio = { version = "1.36", features = ["full"] } +tokio = { version = "1.37", features = ["full"] } futures-util = "0.3.30" pyo3 = "0.20.3" anyhow = { version = "1.0.81", features = ["backtrace"] } diff --git a/ica-rs/ica_typing.py b/ica-rs/ica_typing.py index 6b6a26b..4a2b824 100644 --- a/ica-rs/ica_typing.py +++ b/ica-rs/ica_typing.py @@ -139,9 +139,6 @@ class IcaClient: @property def ica_version() -> str: """shenbot ica 的版本号""" - @property - def matrix_version() -> str: - """shenbot matrix 的版本号""" def debug(self, message: str) -> None: """向日志中输出调试信息""" diff --git a/ica-rs/src/config.rs b/ica-rs/src/config.rs index 391f113..7997421 100644 --- a/ica-rs/src/config.rs +++ b/ica-rs/src/config.rs @@ -24,20 +24,6 @@ pub struct IcaConfig { pub filter_list: Vec, } -/// Matrix 配置 -#[derive(Debug, Clone, Deserialize)] -pub struct MatrixConfig { - /// home server - pub home_server: String, - /// bot_id - pub bot_id: String, - /// bot password - pub bot_password: String, - /// 提醒的房间 - pub notice_room: Vec, - /// 是否提醒 - pub notice_start: bool, -} #[derive(Debug, Clone, Deserialize)] pub struct PyConfig { @@ -54,10 +40,7 @@ pub struct BotConfig { pub enable_ica: Option, /// Ica 配置 pub ica: Option, - /// 是否启用 Matrix - pub enable_matrix: Option, - /// Matrix 配置 - pub matrix: Option, + /// 是否启用 Python 插件 pub enable_py: Option, /// Python 插件配置 @@ -106,26 +89,6 @@ impl BotConfig { } } - /// 检查是否启用 Matrix - pub fn check_matrix(&self) -> bool { - match self.enable_matrix { - Some(enable) => { - if enable && self.matrix.is_none() { - warn!("enable_matrix 为 true 但未填写 [matrix] 配置\n将不启用 Matrix"); - false - } else { - true - } - } - None => { - if self.matrix.is_some() { - warn!("未填写 enable_matrix 但填写了 [matrix] 配置\n将不启用 Matrix"); - } - false - } - } - } - /// 检查是否启用 Python 插件 pub fn check_py(&self) -> bool { match self.enable_py { @@ -147,6 +110,5 @@ impl BotConfig { } pub fn ica(&self) -> IcaConfig { self.ica.clone().expect("No ica config found") } - pub fn matrix(&self) -> MatrixConfig { self.matrix.clone().expect("No matrix config found") } pub fn py(&self) -> PyConfig { self.py.clone().expect("No py config found") } } diff --git a/ica-rs/src/error.rs b/ica-rs/src/error.rs index 863e55e..571ecb2 100644 --- a/ica-rs/src/error.rs +++ b/ica-rs/src/error.rs @@ -6,24 +6,10 @@ pub enum IcaError { SocketIoError(rust_socketio::error::Error), } -#[derive(Debug)] -pub enum MatrixError { - /// Homeserver Url 错误 - HomeserverUrlError(url::ParseError), - /// Http 请求错误 - HttpError(matrix_sdk::HttpError), - /// Matrix Error - MatrixError(matrix_sdk::Error), -} - impl From for IcaError { fn from(e: rust_socketio::Error) -> Self { IcaError::SocketIoError(e) } } -impl From for MatrixError { - fn from(e: matrix_sdk::Error) -> Self { MatrixError::MatrixError(e) } -} - impl std::fmt::Display for IcaError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { @@ -39,23 +25,3 @@ impl std::error::Error for IcaError { } } } - -impl std::fmt::Display for MatrixError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - MatrixError::HomeserverUrlError(e) => write!(f, "Homeserver Url 错误: {}", e), - MatrixError::HttpError(e) => write!(f, "Http 请求错误: {}", e), - MatrixError::MatrixError(e) => write!(f, "Matrix Error: {}", e), - } - } -} - -impl std::error::Error for MatrixError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - MatrixError::HomeserverUrlError(e) => Some(e), - MatrixError::HttpError(e) => Some(e), - MatrixError::MatrixError(e) => Some(e), - } - } -} diff --git a/ica-rs/src/ica/events.rs b/ica-rs/src/ica/events.rs index 1fe9611..3b6a8ca 100644 --- a/ica-rs/src/ica/events.rs +++ b/ica-rs/src/ica/events.rs @@ -7,7 +7,7 @@ use crate::data_struct::ica::all_rooms::Room; use crate::data_struct::ica::messages::{Message, MessageTrait, NewMessage}; use crate::data_struct::ica::online_data::OnlineData; use crate::ica::client::send_message; -use crate::{py, MainStatus, ICA_VERSION, MATRIX_VERSION, VERSION}; +use crate::{py, MainStatus, ICA_VERSION, VERSION}; /// 获取在线数据 pub async fn get_online_data(payload: Payload, _client: Client) { @@ -35,8 +35,8 @@ pub async fn add_message(payload: Payload, client: Client) { // 之后的处理交给插件 if message.content().eq("/bot-rs") && !message.is_from_self() && !message.is_reply() { let reply = message.reply_with(&format!( - "shenbot v{}\nica-async-rs pong v{}\nmatrix v{}", - VERSION, ICA_VERSION, MATRIX_VERSION + "shenbot v{}\nica-async-rs pong v{}", + VERSION, ICA_VERSION )); send_message(&client, &reply).await; } @@ -178,7 +178,7 @@ pub async fn connect_callback(payload: Payload, _client: Client) { event!(Level::INFO, "{}", "需要登录到 icalingua!".yellow()) } Some(msg) => { - event!(Level::INFO, "{}", "未知消息".yellow()); + event!(Level::INFO, "{}{}", "未知消息".yellow(), msg); } None => (), } diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 103ae32..e050900 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -5,8 +5,8 @@ mod data_struct; mod error; #[cfg(feature = "ica")] mod ica; -#[cfg(feature = "matrix")] -mod matrix; +// #[cfg(feature = "tailchat")] +// mod tailchat; mod py; mod status; @@ -16,7 +16,6 @@ use tracing::{event, info, span, Level}; pub static mut MAIN_STATUS: status::BotStatus = status::BotStatus { config: None, ica_status: None, - matrix_status: None, }; pub type MainStatus = status::BotStatus; @@ -25,7 +24,7 @@ pub type StopGetter = tokio::sync::oneshot::Receiver<()>; pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const ICA_VERSION: &str = "1.4.0"; -pub const MATRIX_VERSION: &str = "0.1.0"; +pub const TAILCHAT_VERSION: &str = "0.1.0"; #[macro_export] macro_rules! wrap_callback { @@ -80,19 +79,6 @@ async fn main() { event!(Level::INFO, "未启用 ica"); } - event!(Level::INFO, "启动 Matrix"); - let (matrix_send, matrix_recv) = tokio::sync::oneshot::channel::<()>(); - - if bot_config.check_matrix() { - event!(Level::INFO, "启动 Matrix"); - let config = bot_config.matrix(); - tokio::spawn(async move { - matrix::start_matrix(&config, matrix_recv).await.unwrap(); - }); - } else { - event!(Level::INFO, "未启用 Matrix"); - } - tokio::time::sleep(Duration::from_secs(2)).await; // 等待一个输入 info!("Press any key to exit"); @@ -100,7 +86,6 @@ async fn main() { std::io::stdin().read_line(&mut input).unwrap(); ica_send.send(()).ok(); - matrix_send.send(()).ok(); info!("Disconnected"); } diff --git a/ica-rs/src/matrix.rs b/ica-rs/src/matrix.rs deleted file mode 100644 index 1cb29c4..0000000 --- a/ica-rs/src/matrix.rs +++ /dev/null @@ -1,140 +0,0 @@ -pub mod events; - -use std::{str::FromStr, time::Duration}; - -use futures_util::StreamExt; -use matrix_sdk::{ - config::SyncSettings, - ruma::{ - api::client::message::send_message_event, events::room::message::RoomMessageEventContent, - OwnedRoomId, TransactionId, - }, - Client, -}; -use tracing::{event, span, Level}; -use url::Url; - -use crate::config::MatrixConfig; -use crate::error::{ClientResult, MatrixError}; -use crate::StopGetter; - -pub async fn start_matrix( - config: &MatrixConfig, - mut stop_reciver: StopGetter, -) -> ClientResult<(), MatrixError> { - let span = span!(Level::INFO, "Matrix Client"); - let _enter = span.enter(); - - let homeserver_url = match Url::parse(&config.home_server) { - Ok(url) => url, - Err(e) => { - event!(Level::ERROR, "Homeserver Url 错误: {}", e); - return Err(MatrixError::HomeserverUrlError(e)); - } - }; - let password = &config.bot_password; - let username = &config.bot_id; - - let client = match Client::new(homeserver_url).await { - Ok(client) => { - event!(Level::INFO, "Logged in as {}", username); - client - } - Err(error) => { - event!(Level::ERROR, "Failed to log in as {}: {}", username, error); - return Err(MatrixError::HttpError(error)); - } - }; - - let display_name = format!("shenbot-matrix v{}", crate::MATRIX_VERSION); - - match client - .matrix_auth() - .login_username(&username, &password) - .initial_device_display_name(&display_name) - .await - { - Ok(_) => { - event!(Level::INFO, "Logged in as {}", username); - } - Err(error) => { - event!(Level::ERROR, "Failed to log in as {}: {}", username, error); - return Err(MatrixError::MatrixError(error)); - } - } - - // 发送启动消息 - if config.notice_start { - for room in config.notice_room.iter() { - let startup_msg = RoomMessageEventContent::text_plain(format!( - "shenbot v {}\nmatrix-rs v{} started!", - crate::VERSION, - crate::MATRIX_VERSION - )); - let startup_req: send_message_event::v3::Request = - send_message_event::v3::Request::new( - OwnedRoomId::from_str(&room).unwrap(), - TransactionId::new(), - &startup_msg, - ) - .unwrap(); - - event!(Level::INFO, "发送启动消息到房间: {}", room); - - if let Err(e) = client.send::(startup_req, None).await - { - event!(Level::INFO, "启动信息发送失败 房间:{}|e:{}", room, e); - } - } - } else { - event!(Level::INFO, "未启用启动消息"); - } - - client.add_event_handler(events::on_room_message); - - let init_sync_setting = SyncSettings::new().timeout(Duration::from_mins(10)); - - match client.sync_once(init_sync_setting).await { - Ok(_) => { - event!(Level::INFO, "Synced"); - } - Err(error) => { - event!(Level::ERROR, "Failed to sync: {}", error); - return Err(MatrixError::MatrixError(error)); - } - } - - let mut stream_sync = - Box::pin(client.sync_stream(SyncSettings::new().timeout(Duration::from_mins(10))).await); - - while let Some(Ok(response)) = stream_sync.next().await { - for room in response.rooms.join.values() { - for e in &room.timeline.events { - if let Ok(event) = e.event.deserialize() { - println!("Received event {:?}", event); - } - } - } - if stop_reciver.try_recv().is_ok() { - event!(Level::INFO, "Matrix client stopping"); - break; - } - } - // loop { - // match stop_reciver.try_recv() { - // Ok(_) => { - // event!(Level::INFO, "Matrix client stopping"); - // break; - // } - // Err(tokio::sync::oneshot::error::TryRecvError::Empty) => { - - // } - // Err(tokio::sync::oneshot::error::TryRecvError::Closed) => { - // event!(Level::INFO, "Matrix client stopping"); - // break; - // } - // } - // } - - Ok(()) -} diff --git a/ica-rs/src/matrix/events.rs b/ica-rs/src/matrix/events.rs deleted file mode 100644 index ef72ed8..0000000 --- a/ica-rs/src/matrix/events.rs +++ /dev/null @@ -1,42 +0,0 @@ -use matrix_sdk::{ - ruma::events::room::message::{ - AddMentions, ForwardThread, MessageType, OriginalSyncRoomMessageEvent, - RoomMessageEventContent, - }, - Room, RoomState, -}; -use tracing::{event, span, Level}; - -use crate::py::call::matrix_new_message_py; - -pub async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) { - // We only want to listen to joined rooms. - if room.state() != RoomState::Joined { - return; - } - - // We only want to log text messages. - let MessageType::Text(msgtype) = &event.content.msgtype else { - return; - }; - - // 匹配消息 - - // /bot - if msgtype.body == "/bot" { - let pong = format!("shenbot v {}\nmatrix-rs v{}", crate::VERSION, crate::MATRIX_VERSION); - - let reply = RoomMessageEventContent::text_plain(pong); - let reply = reply.make_reply_to( - &event.into_full_event(room.room_id().to_owned()), - ForwardThread::Yes, - AddMentions::No, - ); - - room.send(reply).await.expect("Failed to send message"); - return; - } - - // 发给 Python 处理剩下的 - matrix_new_message_py().await; -} diff --git a/ica-rs/src/py/call.rs b/ica-rs/src/py/call.rs index fc1b1a5..ab6a123 100644 --- a/ica-rs/src/py/call.rs +++ b/ica-rs/src/py/call.rs @@ -76,7 +76,9 @@ pub fn verify_plugins() { pub const ICA_NEW_MESSAGE_FUNC: &str = "on_ica_message"; pub const ICA_DELETE_MESSAGE_FUNC: &str = "on_ica_delete_message"; -pub const MATRIX_NEW_MESSAGE_FUNC: &str = "on_matrix_message"; +pub const TAILCHAT_NEW_MESSAGE_FUNC: &str = "on_tailchat_message"; + +/// 执行 newpub const MATRIX_NEW_MESSAGE_FUNC: &str = "on_matrix_message"; /// 执行 new message 的 python 插件 pub async fn ica_new_message_py(message: &NewMessage, client: &Client) { @@ -124,22 +126,3 @@ pub async fn ica_delete_message_py(msg_id: MessageId, client: &Client) { }); } } - -pub async fn matrix_new_message_py() { - verify_plugins(); - - let plugins = PyStatus::get_files(); - for (path, plugin) in plugins.iter() { - tokio::spawn(async move { - Python::with_gil(|py| { - if let Some(py_func) = - get_func(plugin.py_module.as_ref(py), path, MATRIX_NEW_MESSAGE_FUNC) - { - if let Err(e) = py_func.call0() { - warn!("failed to call function<{}>: {:?}", MATRIX_NEW_MESSAGE_FUNC, e); - } - } - }) - }); - } -} diff --git a/ica-rs/src/py/class.rs b/ica-rs/src/py/class.rs index ed87b09..81b956d 100644 --- a/ica-rs/src/py/class.rs +++ b/ica-rs/src/py/class.rs @@ -1,5 +1,4 @@ pub mod ica; -pub mod matrix; use pyo3::prelude::*; use toml::Value as TomlValue; diff --git a/ica-rs/src/py/class/ica.rs b/ica-rs/src/py/class/ica.rs index 1bcc85c..0628c32 100644 --- a/ica-rs/src/py/class/ica.rs +++ b/ica-rs/src/py/class/ica.rs @@ -214,8 +214,6 @@ impl IcaClientPy { pub fn get_version(&self) -> String { crate::VERSION.to_string() } #[getter] pub fn get_ica_version(&self) -> String { crate::ICA_VERSION.to_string() } - #[getter] - pub fn get_matrix_version(&self) -> String { crate::MATRIX_VERSION.to_string() } pub fn debug(&self, content: String) { debug!("{}", content); diff --git a/ica-rs/src/py/class/matrix.rs b/ica-rs/src/py/class/matrix.rs deleted file mode 100644 index 8b13789..0000000 --- a/ica-rs/src/py/class/matrix.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ica-rs/src/status.rs b/ica-rs/src/status.rs index ef00dc8..d776875 100644 --- a/ica-rs/src/status.rs +++ b/ica-rs/src/status.rs @@ -5,7 +5,6 @@ use crate::MAIN_STATUS; pub struct BotStatus { pub config: Option, pub ica_status: Option, - pub matrix_status: Option, } impl BotStatus { @@ -19,11 +18,6 @@ impl BotStatus { MAIN_STATUS.ica_status = Some(status); } } - pub fn update_matrix_status(status: matrix::MainStatus) { - unsafe { - MAIN_STATUS.matrix_status = Some(status); - } - } pub fn static_init(config: BotConfig) { unsafe { @@ -34,9 +28,6 @@ impl BotStatus { rooms: Vec::new(), online_status: ica::OnlineData::default(), }); - MAIN_STATUS.matrix_status = Some(matrix::MainStatus { - enable: config.check_matrix(), - }); MAIN_STATUS.config = Some(config); } } @@ -45,16 +36,10 @@ impl BotStatus { pub fn global_ica_status() -> &'static ica::MainStatus { unsafe { MAIN_STATUS.ica_status.as_ref().unwrap() } } - pub fn global_matrix_status() -> &'static matrix::MainStatus { - unsafe { MAIN_STATUS.matrix_status.as_ref().unwrap() } - } pub fn global_ica_status_mut() -> &'static mut ica::MainStatus { unsafe { MAIN_STATUS.ica_status.as_mut().unwrap() } } - pub fn global_matrix_status_mut() -> &'static mut matrix::MainStatus { - unsafe { MAIN_STATUS.matrix_status.as_mut().unwrap() } - } } pub mod ica { @@ -80,12 +65,3 @@ pub mod ica { pub fn update_online_status(&mut self, status: OnlineData) { self.online_status = status; } } } - -pub mod matrix { - - #[derive(Debug, Clone)] - pub struct MainStatus { - /// 是否启用 matrix - pub enable: bool, - } -} diff --git a/news.md b/news.md index fde45cb..3a69dc1 100644 --- a/news.md +++ b/news.md @@ -1,5 +1,15 @@ # 更新日志 +## 0.6.0-dev + +- 去除了 matrix 的支持 + - 淦哦 + - 去除了相应代码和依赖 + - 去除了 Python 侧代码 + - 向 tailchat (typescript 低头) + +- 修复了没法编译的问题( + ## 0.5.3 修复了 Icalingua 断开时 如果 socketio 已经断开会导致程序 返回 Error 的问题