diff --git a/Cargo.lock b/Cargo.lock index c2b1211..a11f384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456d75cbb82da1ad150c8a9d97285ffcd21c9931dcb11e995903e7d75141b38b" +checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" dependencies = [ "gimli", ] @@ -90,28 +90,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a" [[package]] -name = "async-attributes" -version = "1.1.1" +name = "async-h1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423" +checksum = "effd501febce09534b924aa471e6a7fd689071fee63659473413f62a1979ae56" dependencies = [ - "quote 1.0.5", - "syn 1.0.22", + "async-std", + "byte-pool", + "futures-core", + "http-types", + "httparse", + "lazy_static", + "log", + "pin-project-lite", + "url", ] [[package]] name = "async-imap" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ff8df29e2a90154d85d3c21e843d1f6d9337dcdcf23b3b5a87228d18122c84" +checksum = "8113a1ae7ed80ce764f7474f4323b66f945367c2195d046cfa5efdde30fca04c" dependencies = [ - "async-attributes", "async-native-tls", "async-std", "base64 0.11.0", "byte-pool", "chrono", - "futures", + "futures 0.3.5", "imap-proto", "lazy_static", "log", @@ -136,9 +142,9 @@ dependencies = [ [[package]] name = "async-smtp" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3652e5c6072c0694a2bcdb7e8409980d2676bd4f024adf4aab10c68fd2b48f5" +checksum = "bb010dac8f81ceb798b089c522766c0427b54253789194b5c7de9720aeb7f091" dependencies = [ "async-native-tls", "async-std", @@ -154,44 +160,38 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "snafu", + "thiserror", ] [[package]] name = "async-std" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267" +checksum = "a45cee2749d880d7066e328a7e161c7470ced883b2fd000ca4643e9f1dd5083a" dependencies = [ "async-task", - "broadcaster", - "crossbeam-channel", - "crossbeam-deque", "crossbeam-utils", + "futures-channel", "futures-core", "futures-io", "futures-timer", "kv-log-macro", "log", "memchr", - "mio", - "mio-uds", "num_cpus", "once_cell", "pin-project-lite", "pin-utils", "slab", + "smol", + "wasm-bindgen-futures", ] [[package]] name = "async-task" -version = "1.3.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d" -dependencies = [ - "libc", - "winapi 0.3.8", -] +checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" [[package]] name = "async-trait" @@ -200,19 +200,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.8", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -329,20 +318,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "broadcaster" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c972e21e0d055a36cf73e4daae870941fe7a8abcd5ac3396aab9e4c126bd87" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "futures-util", - "parking_lot", - "slab", -] - [[package]] name = "buf_redux" version = "0.8.4" @@ -393,6 +368,16 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "0.5.4" @@ -425,9 +410,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.53" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404b1fe4f65288577753b17e3b36a04596ee784493ec249bf81c7f2d2acd751c" +checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" [[package]] name = "cfb-mode" @@ -502,6 +487,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "cookie" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" +dependencies = [ + "time", +] + [[package]] name = "core-foundation" version = "0.7.0" @@ -533,6 +527,20 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + [[package]] name = "crossbeam-channel" version = "0.4.2" @@ -622,9 +630,9 @@ dependencies = [ "fnv", "ident_case", "proc-macro2", - "quote 1.0.5", + "quote 1.0.6", "strsim", - "syn 1.0.22", + "syn 1.0.27", ] [[package]] @@ -634,8 +642,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -670,14 +678,15 @@ dependencies = [ [[package]] name = "deltachat" -version = "1.33.0" -source = "git+https://github.com/deltachat/deltachat-core-rust?tag=1.33.0#7dc58bb3305e58a73db499ec8c7009a05c654e28" +version = "1.34.0" +source = "git+https://github.com/deltachat/deltachat-core-rust?tag=1.34.0#0a4d6fe09b4041c52439c231cd383884b2987db0" dependencies = [ "anyhow", "async-imap", "async-native-tls", "async-smtp", "async-std", + "async-trait", "backtrace", "base64 0.11.0", "bitflags", @@ -689,6 +698,7 @@ dependencies = [ "email", "encoded-words", "escaper", + "futures 0.3.5", "hex", "image", "image-meta", @@ -703,13 +713,11 @@ dependencies = [ "num-traits", "percent-encoding", "pgp", - "pretty_env_logger", "quick-xml", "r2d2", "r2d2_sqlite", "rand 0.7.3", "regex", - "reqwest", "rusqlite", "sanitize-filename", "serde", @@ -719,17 +727,18 @@ dependencies = [ "stop-token", "strum", "strum_macros", + "surf", "thiserror", - "thread-local-object", + "url", ] [[package]] name = "deltachat_derive" version = "2.0.0" -source = "git+https://github.com/deltachat/deltachat-core-rust?tag=1.33.0#7dc58bb3305e58a73db499ec8c7009a05c654e28" +source = "git+https://github.com/deltachat/deltachat-core-rust?tag=1.34.0#0a4d6fe09b4041c52439c231cd383884b2987db0" dependencies = [ - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -741,8 +750,8 @@ dependencies = [ "darling", "derive_builder_core", "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -753,8 +762,8 @@ checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" dependencies = [ "darling", "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -796,15 +805,9 @@ dependencies = [ "cfg-if", "libc", "redox_users", - "winapi 0.3.8", + "winapi", ] -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "dtoa" version = "0.4.5" @@ -841,7 +844,7 @@ dependencies = [ "lazy_static", "rand 0.7.3", "time", - "version_check 0.9.1", + "version_check 0.9.2", ] [[package]] @@ -937,19 +940,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" -[[package]] -name = "env_logger" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "error-chain" version = "0.12.2" @@ -957,7 +947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" dependencies = [ "backtrace", - "version_check 0.9.1", + "version_check 0.9.2", ] [[package]] @@ -986,8 +976,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", "synstructure", ] @@ -1058,20 +1048,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] -name = "fuchsia-zircon" -version = "0.3.3" +name = "futures" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures" @@ -1129,8 +1109,8 @@ checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -1150,9 +1130,13 @@ dependencies = [ [[package]] name = "futures-timer" -version = "2.0.2" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper", +] [[package]] name = "futures-util" @@ -1160,6 +1144,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ + "futures 0.1.29", "futures-channel", "futures-core", "futures-io", @@ -1172,6 +1157,7 @@ dependencies = [ "proc-macro-hack", "proc-macro-nested", "slab", + "tokio-io", ] [[package]] @@ -1217,22 +1203,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] -name = "h2" -version = "0.2.5" +name = "gloo-timers" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" dependencies = [ - "bytes", - "fnv", + "futures-channel", "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "log", - "slab", - "tokio", - "tokio-util", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -1275,19 +1255,45 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ - "bytes", + "bytes 0.5.4", "fnv", "itoa", ] [[package]] -name = "http-body" -version = "0.3.1" +name = "http-client" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "271fae45413daaca82e8c6bf46e452b897873676ce56196d8939645711f542d5" dependencies = [ - "bytes", + "async-h1", + "async-native-tls", + "async-std", + "futures 0.3.5", + "http-types", + "js-sys", + "log", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "http-types" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49d9f44462c2e59d5d5826e7ba74b121ee2fb0ff091ef849692694f1d77aaf50" +dependencies = [ + "anyhow", + "async-std", + "cookie", "http", + "infer", + "omnom", + "pin-project-lite", + "serde", + "serde_json", + "url", ] [[package]] @@ -1296,52 +1302,6 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "hyper" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "log", - "net2", - "pin-project", - "time", - "tokio", - "tower-service", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-tls", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -1403,6 +1363,15 @@ dependencies = [ "autocfg 1.0.0", ] +[[package]] +name = "infer" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55c406a76164eb346a829ed4b97b73cb06259078eca01adeb12e8ca308d4123" +dependencies = [ + "byteorder", +] + [[package]] name = "inflate" version = "0.4.5" @@ -1460,21 +1429,11 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "kv-log-macro" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d3beed37e5483887d81eb39de6de03a8346531410e1306ca48a9a89bd3a51" +checksum = "4ff57d6d215f7ca7eb35a9a64d656ba4d9d2bef114d741dc08048e75e2f5d418" dependencies = [ "log", ] @@ -1527,9 +1486,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "libdbus-sys" @@ -1598,9 +1557,9 @@ checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" [[package]] name = "mailparse" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7181507a68fef921f011b0c0f143efca20871da5ab3963bdc064537278469cd2" +checksum = "b6435afa64615b3c3efa09cb4066f42dcd236902f30ab48acd36ea59821bb4e0" dependencies = [ "base64 0.10.1", "charset", @@ -1670,48 +1629,6 @@ dependencies = [ "adler32", ] -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "native-tls" version = "0.2.4" @@ -1731,14 +1648,16 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.34" +name = "nix" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" dependencies = [ + "bitflags", + "cc", "cfg-if", "libc", - "winapi 0.3.8", + "void", ] [[package]] @@ -1765,7 +1684,7 @@ checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6" dependencies = [ "lexical-core", "memchr", - "version_check 0.9.1", + "version_check 0.9.2", ] [[package]] @@ -1794,8 +1713,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c8b15b261814f992e33760b1fca9fe8b693d8a65299f20c9901688636cfb746" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -1855,6 +1774,15 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" +[[package]] +name = "omnom" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b216cee2e0d6e680f73158d15468c80b39e571c11669cd90556f9a644e9fd3" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.4.0" @@ -1889,9 +1817,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.56" +version = "0.9.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f02309a7f127000ed50594f0b50ecc69e7c654e16d41b4e8156d1b3df8e0b52e" +checksum = "7410fef80af8ac071d4f63755c0ab89ac3df0fd1ea91f1d1f37cf5cec4395990" dependencies = [ "autocfg 1.0.0", "cc", @@ -1900,15 +1828,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "packed_simd" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85ea9fc0d4ac0deb6fe7911d38786b32fc11119afd9e9d38b84ff691ce64220" -dependencies = [ - "cfg-if", -] - [[package]] name = "parking_lot" version = "0.10.2" @@ -1930,7 +1849,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -1989,22 +1908,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" +checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" +checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -2019,6 +1938,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0deb65f46e873ba8aa7c6a8dbe3f23cb1bf59c339a81a1d56361dde4d66ac8" +dependencies = [ + "crossbeam-utils", + "futures-io", + "futures-sink", + "futures-util", +] + [[package]] name = "pkg-config" version = "0.3.17" @@ -2043,22 +1974,11 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" -[[package]] -name = "pretty_env_logger" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" -dependencies = [ - "chrono", - "env_logger", - "log", -] - [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" [[package]] name = "proc-macro-nested" @@ -2068,9 +1988,9 @@ checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" -version = "1.0.13" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639" +checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" dependencies = [ "unicode-xid 0.2.0", ] @@ -2084,12 +2004,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quick-xml" version = "0.17.2" @@ -2107,9 +2021,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" dependencies = [ "proc-macro2", ] @@ -2133,9 +2047,9 @@ dependencies = [ [[package]] name = "r2d2_sqlite" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b061f5b16692bbe81eeb260f92e6fc7d13aea455c4cbe67f5c4aa20aa92d1d9e" +checksum = "5e15ff794e7c8bb8ae20ccac5bac6a93a4a3af708dd801d4094f80da41196f33" dependencies = [ "r2d2", "rusqlite", @@ -2151,7 +2065,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2162,7 +2076,6 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom", "libc", - "packed_simd", "rand_chacha", "rand_core 0.5.1", "rand_hc", @@ -2261,7 +2174,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2281,44 +2194,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", -] - -[[package]] -name = "reqwest" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b81e49ddec5109a9dcfc5f2a317ff53377c915e9ae9d4f2fb50914b85614e2" -dependencies = [ - "base64 0.11.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "hyper-tls", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "time", - "tokio", - "tokio-tls", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -2352,9 +2229,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a656821bb6317a84b257737b7934f79c0dbb7eb694710475908280ebad3e64" +checksum = "57edf4c4cea4d7e0fab069acb5da9e8e8e5403c78abc81b1f37d83af02148ea5" dependencies = [ "bitflags", "fallible-iterator", @@ -2430,7 +2307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi", ] [[package]] @@ -2442,6 +2319,12 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "scoped-tls-hkt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" + [[package]] name = "scopeguard" version = "1.1.0" @@ -2487,6 +2370,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[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.110" @@ -2503,8 +2392,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -2544,9 +2433,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ "block-buffer", "digest", @@ -2596,24 +2485,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] -name = "snafu" -version = "0.6.8" +name = "smol" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f5aed652511f5c9123cf2afbe9c244c29db6effa2abb05c866e965c82405ce" +checksum = "686c634ad1873fffef6aed20f180eede424fbf3bb31802394c90fd7335a661b7" dependencies = [ - "doc-comment", - "snafu-derive", + "async-task", + "crossbeam", + "futures-io", + "futures-util", + "nix", + "once_cell", + "piper", + "scoped-tls-hkt", + "slab", + "socket2", + "wepoll-binding", ] [[package]] -name = "snafu-derive" -version = "0.6.8" +name = "socket2" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf8f7d5720104a9df0f7076a8682024e958bba0fe9848767bb44f251f3648e9" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" dependencies = [ - "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "cfg-if", + "libc", + "redox_syscall", + "winapi", ] [[package]] @@ -2673,8 +2572,8 @@ checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" dependencies = [ "heck", "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -2683,6 +2582,26 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" +[[package]] +name = "surf" +version = "2.0.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d72c302d4a24b2c9d412f1fe5edd892946778d33c423bba087c6c10deeb656ff" +dependencies = [ + "async-std", + "futures 0.3.5", + "http-client", + "http-types", + "log", + "mime", + "mime_guess", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "url", +] + [[package]] name = "syn" version = "0.11.11" @@ -2696,12 +2615,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.22" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac" +checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" dependencies = [ "proc-macro2", - "quote 1.0.5", + "quote 1.0.6", "unicode-xid 0.2.0", ] @@ -2721,8 +2640,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", "unicode-xid 0.2.0", ] @@ -2731,6 +2650,7 @@ name = "telepathy-padfoot" version = "0.1.0" dependencies = [ "anyhow", + "async-std", "dbus", "deltachat", "directories", @@ -2758,45 +2678,27 @@ dependencies = [ "rand 0.7.3", "redox_syscall", "remove_dir_all", - "winapi 0.3.8", -] - -[[package]] -name = "termcolor" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" -dependencies = [ - "winapi-util", + "winapi", ] [[package]] name = "thiserror" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5976891d6950b4f68477850b5b9e5aa64d955961466f9e174363f573e54e8ca7" +checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab81dbd1cd69cd2ce22ecfbdd3bdb73334ba25350649408cc6c085f46d89573d" +checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", -] - -[[package]] -name = "thread-local-object" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da3caa820d0308c84c8654f6cafd81cc3195d45433311cbe22fcf44fc8be071" -dependencies = [ - "unsafe-any", + "quote 1.0.6", + "syn 1.0.27", ] [[package]] @@ -2815,69 +2717,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi", ] [[package]] -name = "tokio" -version = "0.2.21" +name = "tokio-io" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", - "slab", -] - -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", + "bytes 0.4.12", + "futures 0.1.29", "log", - "pin-project-lite", - "tokio", ] -[[package]] -name = "tower-service" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" - -[[package]] -name = "traitobject" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" - -[[package]] -name = "try-lock" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" - [[package]] name = "try_from" version = "0.3.2" @@ -2910,7 +2763,7 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.9.1", + "version_check 0.9.2", ] [[package]] @@ -2949,15 +2802,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -dependencies = [ - "traitobject", -] - [[package]] name = "url" version = "2.1.1" @@ -2992,9 +2836,15 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" @@ -3003,20 +2853,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi 0.3.8", + "winapi", "winapi-util", ] -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3030,8 +2870,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c7d40d09cdbf0f4895ae58cf57d92e1e57a9dd8ed2e8390514b54a47cc5551" dependencies = [ "cfg-if", - "serde", - "serde_json", "wasm-bindgen-macro", ] @@ -3045,8 +2883,8 @@ dependencies = [ "lazy_static", "log", "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", "wasm-bindgen-shared", ] @@ -3068,7 +2906,7 @@ version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" dependencies = [ - "quote 1.0.5", + "quote 1.0.6", "wasm-bindgen-macro-support", ] @@ -3079,8 +2917,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3102,10 +2940,23 @@ dependencies = [ ] [[package]] -name = "winapi" -version = "0.2.8" +name = "wepoll-binding" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "374fff4ff9701ff8b6ad0d14bacd3156c44063632d8c136186ff5967d48999a7" +dependencies = [ + "bitflags", + "wepoll-sys", +] + +[[package]] +name = "wepoll-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9082a777aed991f6769e2b654aa0cb29f1c3d615daf009829b07b66c7aff6a24" +dependencies = [ + "cc", +] [[package]] name = "winapi" @@ -3117,12 +2968,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3135,7 +2980,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi", ] [[package]] @@ -3144,32 +2989,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.8", -] - [[package]] name = "winutil" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" dependencies = [ - "winapi 0.3.8", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] @@ -3199,7 +3025,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de251eec69fc7c1bc3923403d18ececb929380e016afe103da75f396704f8ca2" dependencies = [ "proc-macro2", - "quote 1.0.5", - "syn 1.0.22", + "quote 1.0.6", + "syn 1.0.27", "synstructure", ] diff --git a/Cargo.toml b/Cargo.toml index 6c1fa4a..c26f8db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,9 @@ license = "MIT" [dependencies] anyhow = "1.0" +async-std = "1.6" dbus = "0.8" -deltachat = { git = "https://github.com/deltachat/deltachat-core-rust", tag="1.33.0" } +deltachat = { git = "https://github.com/deltachat/deltachat-core-rust", tag="1.34.0" } directories = "2.0" rand = "0.7" diff --git a/src/padfoot/channel.rs b/src/padfoot/channel.rs index 95e5fb7..3cab0b8 100644 --- a/src/padfoot/channel.rs +++ b/src/padfoot/channel.rs @@ -11,10 +11,11 @@ pub use type_text::*; use crate::padfoot::{var_bool, var_str, var_str_vec, var_u32, DbusAction, VarArg}; use crate::telepathy; +use async_std::task::block_on; use deltachat as dc; use std::collections::HashMap; -use std::sync::{mpsc, Arc, RwLock}; +use std::sync::{mpsc, Arc}; type Result = std::result::Result; @@ -35,7 +36,7 @@ pub const HANDLE_TYPE_GROUP: HandleType = 4; // Deprecated pub struct Channel { actq: mpsc::Sender, chat_id: dc::chat::ChatId, - ctx: Arc>, + ctx: Arc, initiator_handle: u32, path: dbus::Path<'static>, requested: bool, @@ -51,7 +52,7 @@ impl Channel { pub fn new( actq: mpsc::Sender, chat_id: dc::chat::ChatId, - ctx: Arc>, + ctx: Arc, initiator_handle: u32, path: dbus::Path<'static>, requested: bool, @@ -126,15 +127,15 @@ impl Channel { } pub fn target_contact(&self) -> Option { - let ctx = self.ctx.read().unwrap(); - - dc::contact::Contact::get_by_id(&ctx, self.handle()).ok() + block_on(dc::contact::Contact::get_by_id(&self.ctx, self.handle())).ok() } pub fn initiator_contact(&self) -> Option { - let ctx = self.ctx.read().unwrap(); - - dc::contact::Contact::get_by_id(&ctx, self.initiator_handle).ok() // FIXME: this will be wrong for outbound channels + block_on(dc::contact::Contact::get_by_id( + &self.ctx, + self.initiator_handle, + )) + .ok() // FIXME: this will be wrong for outbound channels } pub fn requested(&self) -> bool { @@ -185,10 +186,11 @@ impl Channel { _ => return, }; - let ctx = self.ctx.read().unwrap(); - if let Err(e) = - dc::imex::continue_key_transfer(&ctx, dc::message::MsgId::new(msg_id), &setup_code) - { + if let Err(e) = block_on(dc::imex::continue_key_transfer( + &self.ctx, + dc::message::MsgId::new(msg_id), + &setup_code, + )) { println!("Failed to apply setup code {}: {}", msg_id, e); } } diff --git a/src/padfoot/channel/messages.rs b/src/padfoot/channel/messages.rs index e7ef44f..b3ea4d8 100644 --- a/src/padfoot/channel/messages.rs +++ b/src/padfoot/channel/messages.rs @@ -1,6 +1,7 @@ use crate::padfoot::{convert_msg, DbusAction, VarArg}; use crate::telepathy; +use async_std::task::block_on; use dbus::message::SignalArgs; use dbus::tree::MethodErr; use dc::constants::Viewtype; @@ -42,10 +43,10 @@ impl telepathy::ChannelInterfaceMessages for Channel { self.try_process_setupmsg(text); }; - let ctx = self.ctx.read().unwrap(); + let ctx = &self.ctx; let blobdir = ctx.get_blobdir(); - let msg_id = match dc::chat::send_msg(&ctx, self.chat_id, &mut delta_msg) { + let msg_id = match block_on(dc::chat::send_msg(&ctx, self.chat_id, &mut delta_msg)) { Ok(msg_id) => msg_id, Err(e) => { println!(" Failed to send message: {}", e); @@ -111,11 +112,11 @@ impl telepathy::ChannelInterfaceMessages for Channel { println!("Channel::pending_messages()"); let mut out = Vec::>>::new(); - let ctx = self.ctx.read().unwrap(); + let ctx = &self.ctx; let blobdir = ctx.get_blobdir(); - for msg_id in dc::chat::get_chat_msgs(&ctx, self.chat_id, 0, None) { - if let Ok(msg) = dc::message::Message::load_from_db(&ctx, msg_id) { + for msg_id in block_on(dc::chat::get_chat_msgs(ctx, self.chat_id, 0, None)) { + if let Ok(msg) = block_on(dc::message::Message::load_from_db(ctx, msg_id)) { match msg.get_state() { MessageState::InFresh | MessageState::InNoticed => { println!(" A message: {:?}", msg); diff --git a/src/padfoot/channel/type_text.rs b/src/padfoot/channel/type_text.rs index b0e532e..1650dc8 100644 --- a/src/padfoot/channel/type_text.rs +++ b/src/padfoot/channel/type_text.rs @@ -2,6 +2,7 @@ use crate::padfoot::DbusAction; use crate::telepathy; use crate::telepathy::ChannelInterfaceMessages; +use async_std::task::block_on; use dbus::message::SignalArgs; use dbus::tree::MethodErr; use dc::message::MsgId; @@ -31,14 +32,13 @@ impl telepathy::ChannelTypeText for Channel { fn acknowledge_pending_messages(&self, ids: Vec) -> Result<()> { println!("Channel::acknowledge_pending_messages({:?})", ids); - let ctx = self.ctx.read().unwrap(); let mut msg_ids = Vec::::new(); for msg_id in &ids { msg_ids.push(MsgId::new(*msg_id)); } print!(" Marking messages as seen..."); - let result = dc::message::markseen_msgs(&ctx, &msg_ids); + let result = block_on(dc::message::markseen_msgs(&self.ctx, msg_ids)); if result { println!("OK!"); diff --git a/src/padfoot/connection.rs b/src/padfoot/connection.rs index 4e26530..98cf5ee 100644 --- a/src/padfoot/connection.rs +++ b/src/padfoot/connection.rs @@ -23,6 +23,7 @@ pub use self::simple_presence::*; use crate::padfoot::{convert_msg, Channel, VarArg}; use crate::telepathy; +use async_std::task::block_on; use dbus::blocking::{stdintf::org_freedesktop_dbus::RequestNameReply, LocalConnection}; use dbus::channel::{MatchingReceiver, Sender}; use dbus::message::SignalArgs; @@ -35,6 +36,7 @@ use deltachat as dc; use std::collections::{HashMap, HashSet}; use std::sync::{mpsc, Arc, Mutex, RwLock}; +use std::thread; use std::time::Duration; pub const CONN_BUS_NAME: &str = "org.freedesktop.Telepathy.Connection.padfoot.delta"; @@ -66,7 +68,7 @@ pub struct Connection { // Owned by the CM. Remove ourselves from this when done conns: Arc>>>, - ctx: Arc>, + ctx: Arc, // Delta contexts are threadsafe settings: ConnSettings, state: Arc>, } @@ -141,9 +143,11 @@ impl Connection { settings: ConnSettings, conns: Arc>>>, ) -> Result<(Self, mpsc::Receiver), MethodErr> { - let mut dbfile = directories::ProjectDirs::from("gs", "ur", "telepathy-padfoot") - .ok_or_else(MethodErr::no_arg) - .and_then(|p| Ok(p.data_local_dir().to_path_buf()))?; + let proj_dir = directories::ProjectDirs::from("gs", "ur", "telepathy-padfoot") + .ok_or_else(MethodErr::no_arg)?; + + let mut dbfile = async_std::path::PathBuf::new(); + dbfile.push(proj_dir.data_local_dir().to_str().unwrap()); dbfile.push(settings.id()); dbfile.push("db.sqlite3"); @@ -151,104 +155,104 @@ impl Connection { let (q_s, q_r) = mpsc::channel::(); let id = settings.id(); - // The closure is shared between several different threads in delta, and - // we can't Send *or* clone the mpsc sender across them, so just wrap it - // in a mutex for now - let queue = Mutex::new(q_s.clone()); - let f = move |_c: &Context, e: Event| { - match e { - Event::Info(msg) => println!("Connection<{}>: INFO: {}", id, msg), - Event::Warning(msg) => println!("Connection<{}>: WARN : {}", id, msg), - Event::Error(msg) | Event::ErrorNetwork(msg) | Event::ErrorSelfNotInGroup(msg) => { - println!("Connection<{}>: ERR : {}", id, msg) - } - Event::ConfigureProgress(progress) => { - println!("Connection<{}>: Configuration progress: {}", id, progress) - } - Event::ImapConnected(msg) | Event::SmtpConnected(msg) => { - println!("Connection<{}>: Network: {}", id, msg); - } - Event::MsgsChanged { chat_id, msg_id } => { - println!( - "Connection<{}>: Messages changed for {}: {}", - id, chat_id, msg_id - ); - queue - .lock() - .unwrap() - .send(DbusAction::IncomingMessage(chat_id, msg_id)) - .unwrap(); - } - Event::IncomingMsg { chat_id, msg_id } => { - println!( - "Connection<{}>: Incoming message for {}: {}", - id, chat_id, msg_id - ); - queue - .lock() - .unwrap() - .send(DbusAction::IncomingMessage(chat_id, msg_id)) - .unwrap(); - } - - /* Unhandled messages: - SmtpMessageSent(String), - ImapMessageDeleted(String), - ImapFolderEmptied(String), - NewBlobFile(String), - DeletedBlobFile(String), - MsgDelivered - MsgFailed - MsgRead - ChatModified(ChatId), - ContactsChanged(Option), - LocationChanged(Option), - ImexProgress(usize), - ImexFileWritten(PathBuf), - SecurejoinInviterProgress - SecurejoinJoinerProgress - */ - Event::ImapMessageMoved(_) | Event::ImapMessageDeleted(_) => {} - _ => println!("Connection<{}>: unhandled event received: {:?}", id, e), - }; - }; - - let ctx = - Context::new(Box::new(f), "telepathy-padfoot".to_string(), dbfile).map_err(|e| { + let ctx = Arc::new( + block_on(Context::new("telepathy-padfoot".to_string(), dbfile)).map_err(|e| { println!( "Connection<{}>::new(): couldn't get delta context: {}", settings.id(), e ); MethodErr::no_arg() // FIXME: better error handling - })?; + })?, + ); - ctx.set_config(Config::Addr, Some(&settings.account)) + let e_ctx = ctx.clone(); + let e_queue = q_s.clone(); + thread::spawn(move || { + let emitter = e_ctx.get_event_emitter(); + while let Some(e) = emitter.recv_sync() { + match e { + Event::Info(msg) => println!("Connection<{}>: INFO: {}", id, msg), + Event::Warning(msg) => println!("Connection<{}>: WARN : {}", id, msg), + Event::Error(msg) + | Event::ErrorNetwork(msg) + | Event::ErrorSelfNotInGroup(msg) => { + println!("Connection<{}>: ERR : {}", id, msg) + } + Event::ConfigureProgress(progress) => { + println!("Connection<{}>: Configuration progress: {}", id, progress) + } + Event::ImapConnected(msg) | Event::SmtpConnected(msg) => { + println!("Connection<{}>: Network: {}", id, msg); + } + Event::MsgsChanged { chat_id, msg_id } => { + println!( + "Connection<{}>: Messages changed for {}: {}", + id, chat_id, msg_id + ); + e_queue + .send(DbusAction::IncomingMessage(chat_id, msg_id)) + .unwrap(); + } + Event::IncomingMsg { chat_id, msg_id } => { + println!( + "Connection<{}>: Incoming message for {}: {}", + id, chat_id, msg_id + ); + e_queue + .send(DbusAction::IncomingMessage(chat_id, msg_id)) + .unwrap(); + } + + /* Unhandled messages: + SmtpMessageSent(String), + ImapMessageDeleted(String), + ImapFolderEmptied(String), + NewBlobFile(String), + DeletedBlobFile(String), + MsgDelivered + MsgFailed + MsgRead + ChatModified(ChatId), + ContactsChanged(Option), + LocationChanged(Option), + ImexProgress(usize), + ImexFileWritten(PathBuf), + SecurejoinInviterProgress + SecurejoinJoinerProgress + */ + Event::ImapMessageMoved(_) | Event::ImapMessageDeleted(_) => {} + _ => println!("Connection<{}>: unhandled event received: {:?}", id, e), + }; + } + }); + + block_on(ctx.set_config(Config::Addr, Some(&settings.account))) .map_err(|_e| MethodErr::no_arg())?; - ctx.set_config(Config::MailPw, Some(&settings.password)) + block_on(ctx.set_config(Config::MailPw, Some(&settings.password))) .map_err(|_e| MethodErr::no_arg())?; if settings.bcc_self { - ctx.set_config(Config::BccSelf, Some(&"1")) + block_on(ctx.set_config(Config::BccSelf, Some(&"1"))) .map_err(|_e| MethodErr::no_arg())?; } else { - ctx.set_config(Config::BccSelf, Some(&"0")) + block_on(ctx.set_config(Config::BccSelf, Some(&"0"))) .map_err(|_e| MethodErr::no_arg())?; } - if !ctx.is_configured() { - ctx.configure(); + if !block_on(ctx.is_configured()) { + block_on(ctx.configure()).unwrap(); }; Ok(( Connection { - conns, - settings, actq: q_s, channels: Arc::new(RwLock::new( HashMap::, Arc>::new(), )), - ctx: Arc::new(RwLock::new(ctx)), + conns, + ctx, + settings, state: Arc::new(RwLock::new(ConnState::Initial)), }, q_r, @@ -399,8 +403,8 @@ impl Connection { let chan_path = Connection::build_channel_path(path.clone(), chat_id); let c2 = Arc::clone(&chans); let chans = c2.read().unwrap(); - let u_ctx = ctx.clone(); - let ctx = u_ctx.read().unwrap(); + //let u_ctx = ctx.clone(); + let ctx = ctx.clone(); let blobdir = ctx.get_blobdir(); // Autocreate channel if it doesn't already exist @@ -408,7 +412,7 @@ impl Connection { if !chans.contains_key(&chan_path) { print!("Channel for {} doesn't exist yet, creating it...", chat_id); - let contacts = dc::chat::get_chat_contacts(&ctx, chat_id); + let contacts = block_on(dc::chat::get_chat_contacts(&ctx, chat_id)); if contacts.len() > 1 { println!("...{} contacts in chat, ignoring!", contacts.len()); continue; @@ -421,7 +425,7 @@ impl Connection { let chan = Channel::new( actq.clone(), chat_id, - u_ctx.clone(), + ctx.clone(), *handle, // initiator is the remote contact chan_path, false, // FIXME: this needs to handle requested channels @@ -437,7 +441,7 @@ impl Connection { // Since the channel exists, emit new message signals print!("Message {} received for {}...", msg_id, chan_path); - let msg = match dc::message::Message::load_from_db(&ctx, msg_id) { + let msg = match block_on(dc::message::Message::load_from_db(&ctx, msg_id)) { Ok(m) => m, Err(e) => { println!("Can't load from database, skipping: {}", e); @@ -474,12 +478,11 @@ impl Connection { DbusAction::FreshMessages => { println!("*** FRESH MESSAGES"); - let ctx_rc = ctx.clone(); - let ctx = ctx_rc.read().unwrap(); + let ctx = ctx.clone(); - for msg_id in dc::context::Context::get_fresh_msgs(&ctx) { + for msg_id in block_on(dc::context::Context::get_fresh_msgs(&ctx)) { println!(" FRESH MESSAGE: {}", msg_id); - match dc::message::Message::load_from_db(&ctx, msg_id) { + match block_on(dc::message::Message::load_from_db(&ctx, msg_id)) { Ok(msg) => { actq.send(DbusAction::IncomingMessage( msg.get_chat_id(), diff --git a/src/padfoot/connection/connection.rs b/src/padfoot/connection/connection.rs index b644a47..09dc4d6 100644 --- a/src/padfoot/connection/connection.rs +++ b/src/padfoot/connection/connection.rs @@ -1,6 +1,7 @@ use crate::telepathy; use crate::telepathy::{ConnectionInterfaceContacts, ConnectionInterfaceRequests}; // Non-deprecated channel methods +use async_std::task::block_on; use dbus::message::SignalArgs; use dbus::tree::MethodErr; use dc::contact::Contact; @@ -57,64 +58,12 @@ impl telepathy::Connection for Connection { fn connect(&self) -> Result<()> { println!("Connection<{}>::connect()", self.id()); - let inbox_ctx = self.ctx.clone(); - let state = self.state.clone(); - let id = self.id(); - let _inbox_thread = thread::spawn(move || { - while *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_inbox_jobs(&inbox_ctx.read().unwrap()); - if *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_inbox_fetch(&inbox_ctx.read().unwrap()); + let io_ctx = self.ctx.clone(); + let io_id = self.id(); + let _io_thread = thread::spawn(move || { + block_on(io_ctx.start_io()); - if *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_inbox_idle(&inbox_ctx.read().unwrap()); - } - } - } - - println!("Connection<{}>::connect(): inbox thread exited", id); - }); - - let smtp_ctx = self.ctx.clone(); - let state = self.state.clone(); - let id = self.id(); - let _smtp_thread = thread::spawn(move || { - while *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_smtp_jobs(&smtp_ctx.read().unwrap()); - if *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_smtp_idle(&smtp_ctx.read().unwrap()); - } - } - - println!("Connection<{}>::connect(): smtp thread exited", id); - }); - - let mvbox_ctx = self.ctx.clone(); - let state = self.state.clone(); - let id = self.id(); - let _mvbox_thread = thread::spawn(move || { - while *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_mvbox_fetch(&mvbox_ctx.read().unwrap()); - if *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_mvbox_idle(&mvbox_ctx.read().unwrap()); - } - } - - println!("Connection<{}>::connect(): mvbox thread exited", id); - }); - - let sentbox_ctx = self.ctx.clone(); - let state = self.state.clone(); - let id = self.id(); - let _sentbox_thread = thread::spawn(move || { - while *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_sentbox_fetch(&sentbox_ctx.read().unwrap()); - if *state.read().unwrap() != ConnState::Disconnected { - dc::job::perform_sentbox_idle(&sentbox_ctx.read().unwrap()); - } - } - - println!("Connection<{}>::connect(): sentbox thread exited", id); + println!("Connection<{}>::connect(): I/O thread exited", io_id); }); // Just pretend to be connected all the time for now. Tracking IMAP+SMTP @@ -122,7 +71,7 @@ impl telepathy::Connection for Connection { let state = self.state.clone(); let mut w = state.write().unwrap(); *w = ConnState::Connected; - let ctx = self.ctx.read().unwrap(); + let ctx = self.ctx.clone(); // Emit a StatusChanged signal for the benefit of others, but the caller // learns from our RPC response @@ -136,13 +85,13 @@ impl telepathy::Connection for Connection { self.actq.send(DbusAction::FreshMessages).unwrap(); // If we can, emit signals on connect about the contact list - if let Ok(handles) = Contact::get_all( + if let Ok(handles) = block_on(Contact::get_all( &ctx, (dc::constants::DC_GCL_ADD_SELF as usize) .try_into() .unwrap(), None::, - ) { + )) { println!(" HANDLES: {:?}", handles); let mut changes = HashMap::::new(); for handle in handles { @@ -170,17 +119,12 @@ impl telepathy::Connection for Connection { fn disconnect(&self) -> Result<()> { println!("Connection<{}>::disconnect()", self.id()); - let ctx = self.ctx.read().unwrap(); + block_on(self.ctx.stop_io()); let state = self.state.clone(); let mut w = state.write().unwrap(); *w = ConnState::Disconnected; - dc::job::interrupt_inbox_idle(&ctx); - dc::job::interrupt_smtp_idle(&ctx); - dc::job::interrupt_sentbox_idle(&ctx); - dc::job::interrupt_mvbox_idle(&ctx); - // FIXME: we need to signal to the CM that they should remove the // connection from the active list @@ -330,7 +274,7 @@ impl telepathy::Connection for Connection { match handle_type { crate::padfoot::HANDLE_TYPE_CONTACT => { - let ctx = self.ctx.read().unwrap(); + let ctx = &self.ctx; let mut out = Vec::::new(); // Identifiers is a list of email addresses. These can be @@ -340,12 +284,16 @@ impl telepathy::Connection for Connection { // FIXME: will it be faster to get all and filter? for addr in identifiers { - let id = Contact::lookup_id_by_addr(&ctx, addr, dc::contact::Origin::Unknown); + let id = block_on(Contact::lookup_id_by_addr( + ctx, + addr, + dc::contact::Origin::Unknown, + )); match id { 0 => { // No contact exists for this address yet. Try to // add one so we can have an ID. - match Contact::create(&ctx, &addr, &addr) { + match block_on(Contact::create(ctx, &addr, &addr)) { Ok(new_id) => out.push(new_id), Err(e) => { println!("Failed to add contact {}: {}", addr, e); @@ -384,10 +332,10 @@ impl telepathy::Connection for Connection { fn self_id(&self) -> Result { println!("Connection<{}>::self_id()", self.id()); - let contact = match dc::contact::Contact::get_by_id( - &self.ctx.read().unwrap(), + let contact = match block_on(dc::contact::Contact::get_by_id( + &self.ctx, dc::constants::DC_CONTACT_ID_SELF, - ) { + )) { Ok(c) => c, Err(e) => { println!(" err: {}", e); diff --git a/src/padfoot/connection/contact_list.rs b/src/padfoot/connection/contact_list.rs index 8b3bc98..8e15070 100644 --- a/src/padfoot/connection/contact_list.rs +++ b/src/padfoot/connection/contact_list.rs @@ -1,6 +1,7 @@ use crate::padfoot::VarArg; use crate::telepathy; +use async_std::task::block_on; use dbus::tree::MethodErr; use dc::constants::DC_GCL_ADD_SELF; use dc::contact::Contact; @@ -31,8 +32,11 @@ impl telepathy::ConnectionInterfaceContactList for Connection { hold ); - let ctx = &self.ctx.read().unwrap(); - let ids = match Contact::get_all(ctx, DC_GCL_ADD_SELF.try_into().unwrap(), None::) { + let ids = match block_on(Contact::get_all( + &self.ctx, + DC_GCL_ADD_SELF.try_into().unwrap(), + None::, + )) { Ok(c) => c, Err(e) => { println!(" err: {}", e); @@ -65,11 +69,9 @@ impl telepathy::ConnectionInterfaceContactList for Connection { fn remove_contacts(&self, contacts: Vec) -> Result<(), MethodErr> { println!("Connection<{}>::remove_contacts({:?})", self.id(), contacts); - let ctx = self.ctx.read().unwrap(); - for contact_id in contacts { // FIXME: don't ignore errors - if let Err(e) = Contact::delete(&ctx, contact_id) { + if let Err(e) = block_on(Contact::delete(&self.ctx, contact_id)) { println!(" Deleting contact {} failed: {}", contact_id, e); } } diff --git a/src/padfoot/connection/contacts.rs b/src/padfoot/connection/contacts.rs index 2272c6d..95c2feb 100644 --- a/src/padfoot/connection/contacts.rs +++ b/src/padfoot/connection/contacts.rs @@ -1,6 +1,7 @@ use crate::padfoot::{var_str, var_u32, VarArg}; use crate::telepathy; +use async_std::task::block_on; use dbus::tree::MethodErr; use deltachat::contact::{Contact, Origin}; use std::collections::HashMap; @@ -31,7 +32,7 @@ impl telepathy::ConnectionInterfaceContacts for Connection { let mut out = HashMap::>::new(); for id in handles.iter() { // FIXME: work out how to use get_all - let contact = match Contact::get_by_id(&self.ctx.read().unwrap(), *id) { + let contact = match block_on(Contact::get_by_id(&self.ctx, *id)) { Ok(c) => c, Err(_e) => continue, // Invalid IDs are silently ignored }; @@ -77,10 +78,11 @@ impl telepathy::ConnectionInterfaceContacts for Connection { interfaces ); - let id = { - let ctx = &self.ctx.read().unwrap(); - Contact::lookup_id_by_addr(ctx, identifier, Origin::Unknown) - }; + let id = block_on(Contact::lookup_id_by_addr( + &self.ctx, + identifier, + Origin::Unknown, + )); if id == 0 { return Err(MethodErr::no_arg()); // FIXME: should be InvalidHandle diff --git a/src/padfoot/connection/requests.rs b/src/padfoot/connection/requests.rs index 94a2c69..6692c2f 100644 --- a/src/padfoot/connection/requests.rs +++ b/src/padfoot/connection/requests.rs @@ -1,6 +1,7 @@ use crate::padfoot::{get_var_str, get_var_u32, requestables, Channel, DbusAction, VarArg}; use crate::telepathy; +use async_std::task::block_on; use dbus::tree::MethodErr; use dc::contact::Contact; use deltachat as dc; @@ -77,10 +78,11 @@ impl telepathy::ConnectionInterfaceRequests for Connection { return Err(MethodErr::no_arg()); }; - let ctx = self.ctx.read().unwrap(); - - let target_handle = - Contact::lookup_id_by_addr(&ctx, target_id.clone(), dc::contact::Origin::Unknown); + let target_handle = block_on(Contact::lookup_id_by_addr( + &self.ctx, + target_id.clone(), + dc::contact::Origin::Unknown, + )); if target_handle == 0 { println!("Couldn't find target handle for {}", target_id); return Err(MethodErr::no_arg()); @@ -96,7 +98,7 @@ impl telepathy::ConnectionInterfaceRequests for Connection { } // Now we need to discover or create a chat id for the contact - let chat_id = dc::chat::create_by_contact_id(&ctx, target_handle).unwrap(); + let chat_id = block_on(dc::chat::create_by_contact_id(&self.ctx, target_handle)).unwrap(); let channel = Channel::new( self.actq.clone(), chat_id, diff --git a/src/padfoot/message.rs b/src/padfoot/message.rs index d6acd65..9a56b1a 100644 --- a/src/padfoot/message.rs +++ b/src/padfoot/message.rs @@ -1,5 +1,6 @@ use crate::padfoot::{var_bytearray, var_i64, var_str, var_u32, VarArg}; +use async_std::path::{Path, PathBuf}; use dc::constants::Viewtype as Vt; use dc::message::Message; use deltachat as dc; @@ -10,7 +11,7 @@ type Part = HashMap; type Result = std::result::Result>; // Turns a deltachat::message::Message into a Telepathy Message_Part_List -pub fn convert_msg(blobdir: &std::path::Path, msg: &Message) -> Result> { +pub fn convert_msg(blobdir: &Path, msg: &Message) -> Result> { if msg.is_setupmessage() { return Ok(convert_setupmessage(msg)); } @@ -110,15 +111,13 @@ fn build_vid(_msg: &Message) -> Result> { // The message contains a file. Detect the content-type and construct a part // containing the data in full. -fn build_attachment(blobdir: &std::path::Path, msg: &Message) -> Result> { +fn build_attachment(blobdir: &Path, msg: &Message) -> Result> { let mime = msg .get_filemime() .unwrap_or_else(|| "application/octet-stream".to_string()); let filename = msg.get_filename().ok_or("Failed to get filename")?; - let path: std::path::PathBuf = [blobdir, &std::path::Path::new(&filename)].iter().collect(); - // let mut path = std::path::PathBuf::from(blobdir); - // path.push(filename); + let path: PathBuf = [blobdir, &Path::new(&filename)].iter().collect(); let data = std::fs::read(&path).map_err(|e| format!("Failed to read file {:?}: {}", path, e))?;