matrix-sdk: Bump Ruma
This commit is contained in:
parent
ffaddb22b8
commit
1f5cad136e
10 changed files with 38 additions and 31 deletions
|
@ -3,7 +3,7 @@ use std::{env, process::exit};
|
|||
use matrix_sdk::{
|
||||
self, async_trait,
|
||||
events::{
|
||||
room::message::{MessageEventContent, TextMessageEventContent},
|
||||
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
|
||||
AnyMessageEventContent, SyncMessageEvent,
|
||||
},
|
||||
Client, ClientConfig, EventHandler, RoomState, SyncSettings,
|
||||
|
@ -31,13 +31,17 @@ impl EventHandler for CommandBot {
|
|||
) {
|
||||
if let RoomState::Joined(room) = room {
|
||||
let msg_body = if let SyncMessageEvent {
|
||||
content: MessageEventContent::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
content:
|
||||
MessageEventContent {
|
||||
msgtype: MessageType::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
..
|
||||
},
|
||||
..
|
||||
} = event
|
||||
{
|
||||
msg_body.clone()
|
||||
msg_body
|
||||
} else {
|
||||
String::new()
|
||||
return;
|
||||
};
|
||||
|
||||
if msg_body.contains("!party") {
|
||||
|
|
|
@ -10,9 +10,7 @@ use url::Url;
|
|||
|
||||
use matrix_sdk::{
|
||||
self,
|
||||
events::{
|
||||
room::message::MessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
||||
},
|
||||
events::{room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent},
|
||||
identifiers::UserId,
|
||||
Client, LoopCtrl, Sas, SyncSettings,
|
||||
};
|
||||
|
@ -130,7 +128,7 @@ async fn login(
|
|||
if let AnySyncRoomEvent::Message(event) = event {
|
||||
match event {
|
||||
AnySyncMessageEvent::RoomMessage(m) => {
|
||||
if let MessageEventContent::VerificationRequest(_) = &m.content
|
||||
if let MessageType::VerificationRequest(_) = &m.content.msgtype
|
||||
{
|
||||
let request = client
|
||||
.get_verification_request(&m.event_id)
|
||||
|
|
|
@ -11,7 +11,7 @@ use tokio::sync::Mutex;
|
|||
use matrix_sdk::{
|
||||
self, async_trait,
|
||||
events::{
|
||||
room::message::{MessageEventContent, TextMessageEventContent},
|
||||
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
|
||||
SyncMessageEvent,
|
||||
},
|
||||
Client, EventHandler, RoomState, SyncSettings,
|
||||
|
@ -39,7 +39,11 @@ impl EventHandler for ImageBot {
|
|||
) {
|
||||
if let RoomState::Joined(room) = room {
|
||||
let msg_body = if let SyncMessageEvent {
|
||||
content: MessageEventContent::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
content:
|
||||
MessageEventContent {
|
||||
msgtype: MessageType::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
..
|
||||
},
|
||||
..
|
||||
} = event
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ use url::Url;
|
|||
use matrix_sdk::{
|
||||
self, async_trait,
|
||||
events::{
|
||||
room::message::{MessageEventContent, TextMessageEventContent},
|
||||
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
|
||||
SyncMessageEvent,
|
||||
},
|
||||
Client, EventHandler, RoomState, SyncSettings,
|
||||
|
@ -21,7 +21,11 @@ impl EventHandler for EventCallback {
|
|||
) {
|
||||
if let RoomState::Joined(room) = room {
|
||||
if let SyncMessageEvent {
|
||||
content: MessageEventContent::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
content:
|
||||
MessageEventContent {
|
||||
msgtype: MessageType::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||
..
|
||||
},
|
||||
sender,
|
||||
..
|
||||
} = event
|
||||
|
|
|
@ -93,7 +93,7 @@ use matrix_sdk_common::{
|
|||
room::{
|
||||
message::{
|
||||
AudioMessageEventContent, FileMessageEventContent, ImageMessageEventContent,
|
||||
MessageEventContent, VideoMessageEventContent,
|
||||
MessageEventContent, MessageType, VideoMessageEventContent,
|
||||
},
|
||||
EncryptedFile,
|
||||
},
|
||||
|
@ -1378,26 +1378,26 @@ impl Client {
|
|||
let content = match content_type.type_() {
|
||||
mime::IMAGE => {
|
||||
// TODO create a thumbnail using the image crate?.
|
||||
MessageEventContent::Image(ImageMessageEventContent {
|
||||
MessageType::Image(ImageMessageEventContent {
|
||||
body: body.to_owned(),
|
||||
info: None,
|
||||
url: Some(url),
|
||||
file: encrypted_file,
|
||||
})
|
||||
}
|
||||
mime::AUDIO => MessageEventContent::Audio(AudioMessageEventContent {
|
||||
mime::AUDIO => MessageType::Audio(AudioMessageEventContent {
|
||||
body: body.to_owned(),
|
||||
info: None,
|
||||
url: Some(url),
|
||||
file: encrypted_file,
|
||||
}),
|
||||
mime::VIDEO => MessageEventContent::Video(VideoMessageEventContent {
|
||||
mime::VIDEO => MessageType::Video(VideoMessageEventContent {
|
||||
body: body.to_owned(),
|
||||
info: None,
|
||||
url: Some(url),
|
||||
file: encrypted_file,
|
||||
}),
|
||||
_ => MessageEventContent::File(FileMessageEventContent {
|
||||
_ => MessageType::File(FileMessageEventContent {
|
||||
filename: None,
|
||||
body: body.to_owned(),
|
||||
info: None,
|
||||
|
@ -1408,7 +1408,7 @@ impl Client {
|
|||
|
||||
self.room_send(
|
||||
room_id,
|
||||
AnyMessageEventContent::RoomMessage(content),
|
||||
AnyMessageEventContent::RoomMessage(MessageEventContent::new(content)),
|
||||
txn_id,
|
||||
)
|
||||
.await
|
||||
|
|
|
@ -22,7 +22,7 @@ async-trait = "0.1.42"
|
|||
[dependencies.ruma]
|
||||
version = "0.0.2"
|
||||
git = "https://github.com/ruma/ruma"
|
||||
rev = "d6aa37c848b7f682a98c25b346899e284ffc6df7"
|
||||
rev = "c27e66741a8cb0cf5dba45ae3a977f4d6bba715d"
|
||||
features = ["client-api", "compat", "unstable-pre-spec"]
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
|
|
|
@ -1201,7 +1201,7 @@ pub(crate) mod test {
|
|||
events::{
|
||||
room::{
|
||||
encrypted::EncryptedEventContent,
|
||||
message::{MessageEventContent, TextMessageEventContent},
|
||||
message::{MessageEventContent, MessageType},
|
||||
},
|
||||
AnyMessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
|
||||
EventType, SyncMessageEvent, ToDeviceEvent, Unsigned,
|
||||
|
@ -1746,7 +1746,7 @@ pub(crate) mod test {
|
|||
|
||||
let plaintext = "It is a secret to everybody";
|
||||
|
||||
let content = MessageEventContent::Text(TextMessageEventContent::plain(plaintext));
|
||||
let content = MessageEventContent::text_plain(plaintext);
|
||||
|
||||
let encrypted_content = alice
|
||||
.encrypt(
|
||||
|
@ -1778,7 +1778,7 @@ pub(crate) mod test {
|
|||
..
|
||||
})) => {
|
||||
assert_eq!(&sender, alice.user_id());
|
||||
if let MessageEventContent::Text(c) = &content {
|
||||
if let MessageType::Text(c) = &content.msgtype {
|
||||
assert_eq!(&c.body, plaintext);
|
||||
} else {
|
||||
panic!("Decrypted event has a missmatched content");
|
||||
|
|
|
@ -129,10 +129,7 @@ mod test {
|
|||
};
|
||||
|
||||
use matrix_sdk_common::{
|
||||
events::{
|
||||
room::message::{MessageEventContent, TextMessageEventContent},
|
||||
AnyMessageEventContent,
|
||||
},
|
||||
events::{room::message::MessageEventContent, AnyMessageEventContent},
|
||||
identifiers::{room_id, user_id},
|
||||
};
|
||||
|
||||
|
@ -156,7 +153,7 @@ mod test {
|
|||
assert!(!session.expired());
|
||||
let _ = session
|
||||
.encrypt(AnyMessageEventContent::RoomMessage(
|
||||
MessageEventContent::Text(TextMessageEventContent::plain("Test message")),
|
||||
MessageEventContent::text_plain("Test message"),
|
||||
))
|
||||
.await;
|
||||
assert!(session.expired());
|
||||
|
|
|
@ -20,7 +20,7 @@ use tracing::{info, trace, warn};
|
|||
|
||||
use matrix_sdk_common::{
|
||||
events::{
|
||||
room::message::MessageEventContent, AnyMessageEvent, AnySyncMessageEvent, AnySyncRoomEvent,
|
||||
room::message::MessageType, AnyMessageEvent, AnySyncMessageEvent, AnySyncRoomEvent,
|
||||
AnyToDeviceEvent,
|
||||
},
|
||||
identifiers::{DeviceId, EventId, RoomId, UserId},
|
||||
|
@ -233,7 +233,7 @@ impl VerificationMachine {
|
|||
|
||||
match m {
|
||||
AnySyncMessageEvent::RoomMessage(m) => {
|
||||
if let MessageEventContent::VerificationRequest(r) = &m.content {
|
||||
if let MessageType::VerificationRequest(r) = &m.content.msgtype {
|
||||
if self.account.user_id() == &r.to {
|
||||
info!(
|
||||
"Received a new verification request from {} {}",
|
||||
|
|
|
@ -1345,7 +1345,7 @@ mod test {
|
|||
|
||||
*method = AcceptMethod::Custom(CustomContent {
|
||||
method: "m.sas.custom".to_string(),
|
||||
fields: vec![].into_iter().collect(),
|
||||
data: vec![].into_iter().collect(),
|
||||
});
|
||||
|
||||
alice
|
||||
|
@ -1394,7 +1394,7 @@ mod test {
|
|||
|
||||
*method = StartMethod::Custom(CustomStartContent {
|
||||
method: "m.sas.custom".to_string(),
|
||||
fields: vec![].into_iter().collect(),
|
||||
data: vec![].into_iter().collect(),
|
||||
});
|
||||
|
||||
SasState::<Started>::from_start_event(bob.clone(), alice_device, None, start_content)
|
||||
|
|
Loading…
Reference in a new issue