matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Can you please make `create_dm_room` public?

Open timthelion opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I would like to start DM chats using my bot (my bot is actually going to test other bots , so it needs to pretend to be a client).

Describe the solution you'd like I'd like create_dm_room to be public so I can start DM chats.

timthelion avatar Aug 02 '22 20:08 timthelion

Sure, but I think that will have to wait for #868 to be finished.

poljar avatar Aug 03 '22 07:08 poljar

#868 is now finished. @timthelion are you willing to open a PR to fix your request?

Hywan avatar Aug 16 '22 07:08 Hywan

Yeah, sure, I'll see what I can do.

timthelion avatar Aug 16 '22 10:08 timthelion

So I managed to delete the (crate) thing to make it public and add a few sentences of docs. But when I went to actually build it I got this really weird error:

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/gossiping/machine.rs:929:21
    |
929 | /                     info!(
930 | |                         %sender,
931 | |                         sender_key = sender_key.to_base64(),
932 | |                         claimed_sender_key = content.claimed_sender_key.to_base64(),
...   |
935 | |                         "Received a forwarded room key",
936 | |                     );
    | |_____________________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/gossiping/machine.rs:974:21
    |
974 | /                     warn!(
975 | |                         sender = event.sender.as_str(),
976 | |                         sender_key = sender_key.to_base64(),
977 | |                         room_id = content.room_id.as_str(),
...   |
981 | |                         "Received a forwarded room key that we didn't request",
982 | |                     );
    | |_____________________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/olm/account.rs:197:13
    |
197 | /             warn!(
198 | |                 sender = sender.as_str(),
199 | |                 sender_key = content.sender_key.to_base64(),
200 | |                 "Olm event doesn't contain a ciphertext for our key"
201 | |             );
    | |_____________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/machine.rs:558:13
    |
558 | /             warn!(
559 | |                 sender = %event.sender,
560 | |                 sender_key = sender_key.to_base64(),
561 | |                 algorithm = %event.content.algorithm(),
562 | |                 "Received room key with unsupported key algorithm",
563 | |             );
    | |_____________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
    --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/machine.rs:1073:21
     |
1073 | /                     trace!(
1074 | |                         sender = event.sender.as_str(),
1075 | |                         room_id = room_id.as_str(),
1076 | |                         session_id = session.session_id(),
...    |
1079 | |                         "Successfully decrypted a room event"
1080 | |                     );
     | |_____________________^ the trait `tracing::Value` is not implemented for `std::string::String`
     |
     = help: the trait `tracing::Value` is implemented for `str`
     = note: required for the cast to the object type `dyn tracing::Value`
     = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
    --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/machine.rs:1155:17
     |
1155 | /                 debug!(
1156 | |                     sender = event.sender.as_str(),
1157 | |                     room_id = room_id.as_str(),
1158 | |                     sender_key = content.sender_key().to_base64(),
...    |
1161 | |                     "Failed to decrypt a room event, the room key is missing"
1162 | |                 );
     | |_________________^ the trait `tracing::Value` is not implemented for `std::string::String`
     |
     = help: the trait `tracing::Value` is implemented for `str`
     = note: required for the cast to the object type `dyn tracing::Value`
     = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
    --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/machine.rs:1383:21
     |
1383 | /                     warn!(
1384 | |                         sender_key= key.sender_key.to_base64(),
1385 | |                         room_id = %key.room_id,
1386 | |                         session_id = key.session_id,
1387 | |                         error = ?e,
1388 | |                         "Couldn't import a room key from a file export."
1389 | |                     );
     | |_____________________^ the trait `tracing::Value` is not implemented for `std::string::String`
     |
     = help: the trait `tracing::Value` is implemented for `str`
     = note: required for the cast to the object type `dyn tracing::Value`
     = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/olm/account.rs:378:17
    |
378 | /                 warn!(
379 | |                     sender = sender.as_str(),
380 | |                     sender_key = sender_key.to_base64(),
381 | |                     error = ?e,
382 | |                     "A to-device message was successfully decrypted but \
383 | |                     parsing and checking the event fields failed"
384 | |                 );
    | |_________________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/verification/sas/helpers.rs:217:9
    |
217 | /         trace!(
218 | |             %sender,
219 | |             device_id = %ids.other_device.device_id(),
220 | |             key_id,
221 | |             "Checking a SAS MAC",
222 | |         );
    | |_________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required because of the requirements on the impl of `tracing::Value` for `&std::string::String`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `std::string::String: tracing::Value` is not satisfied
   --> /vb/third-party/matrix-rust-sdk/crates/matrix-sdk-crypto/src/verification/sas/sas_state.rs:547:13
    |
547 | /             info!(
548 | |                 public_key = our_public_key.to_base64(),
549 | |                 %commitment,
550 | |                 ?content,
551 | |                 "Calculated SAS commitment",
552 | |             );
    | |_____________^ the trait `tracing::Value` is not implemented for `std::string::String`
    |
    = help: the trait `tracing::Value` is implemented for `str`
    = note: required for the cast to the object type `dyn tracing::Value`
    = note: this error originates in the macro `$crate::valueset` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `matrix-sdk-crypto` due to 10 previous errors
test@90c73a876dec:/vb/util/matrix-bot-tester$

I'm at 06f39696d30541aa5a291fbd15dfa93dfc8112f9 which is the latest commit in main as of this writing. Does main build?

timthelion avatar Aug 16 '22 19:08 timthelion

yes, main builds: image

how are you building and testing it, @timthelion ?

gnunicorn avatar Aug 17 '22 07:08 gnunicorn

I'm pulling it in as a dependency as so: https://github.com/vegan-buddies/vegan-buddies/blob/default/util/matrix-bot-tester/Cargo.toml

In this docker image: https://github.com/vegan-buddies/vegan-buddies/blob/default/matrix-geographic-user-index/Dockerfile

I ran cargo test on in the matrix-bot-tester dir and it failed to build the dependency.

timthelion avatar Aug 17 '22 07:08 timthelion

Just a quick look but:

matrix-sdk =  { path = "../../third-party/matrix-rust-sdk/crates/matrix-sdk/" }
matrix-sdk-common = "0.5.0"

those two don't mix. if you switch to main, you must switch all matrix-sdk*-crates to main.

gnunicorn avatar Aug 17 '22 07:08 gnunicorn

Also matrix-sdk-common is not something you should depend on directly. matrix-sdk re-exports everything from it.

jplatte avatar Aug 17 '22 08:08 jplatte

Yelp! Thanks for the help. I think this is all that's needed (See PR mentioned above), though I wasn't able to finish testing it due to time constraints and my inexperience with async rust.

timthelion avatar Aug 17 '22 10:08 timthelion

This has been closed by https://github.com/matrix-org/matrix-rust-sdk/pull/1015.

poljar avatar Sep 07 '22 11:09 poljar