fix(crypto-ffi): Allow room message requests to be marked as sent

This commit is contained in:
Damir Jelić
2022-05-03 10:59:16 +02:00
3 changed files with 15 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ use ruma::{
upload_keys::v3::Response as KeysUploadResponse,
upload_signatures::v3::Response as SignatureUploadResponse,
},
message::send_message_event::v3::Response as RoomMessageResponse,
sync::sync_events::v3::{DeviceLists as RumaDeviceLists, ToDevice},
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
},
@@ -330,6 +331,9 @@ impl OlmMachine {
RequestType::KeysBackup => {
KeysBackupResponse::try_from_http_response(response).map(Into::into)
}
RequestType::RoomMessage => {
RoomMessageResponse::try_from_http_response(response).map(Into::into)
}
}
.expect("Can't convert json string to response");

View File

@@ -244,6 +244,7 @@ enum RequestType {
"ToDevice",
"SignatureUpload",
"KeysBackup",
"RoomMessage",
};
interface OlmMachine {

View File

@@ -18,6 +18,7 @@ use ruma::{
Request as RustSignatureUploadRequest, Response as SignatureUploadResponse,
},
},
message::send_message_event::v3::Response as RoomMessageResponse,
sync::sync_events::v3::DeviceLists as RumaDeviceLists,
to_device::send_event_to_device::v3::Response as ToDeviceResponse,
},
@@ -226,6 +227,7 @@ pub enum RequestType {
ToDevice,
SignatureUpload,
KeysBackup,
RoomMessage,
}
pub struct DeviceLists {
@@ -269,6 +271,7 @@ pub(crate) enum OwnedResponse {
ToDevice(ToDeviceResponse),
SignatureUpload(SignatureUploadResponse),
KeysBackup(KeysBackupResponse),
RoomMessage(RoomMessageResponse),
}
impl From<KeysClaimResponse> for OwnedResponse {
@@ -307,6 +310,12 @@ impl From<KeysBackupResponse> for OwnedResponse {
}
}
impl From<RoomMessageResponse> for OwnedResponse {
fn from(response: RoomMessageResponse) -> Self {
OwnedResponse::RoomMessage(response)
}
}
impl<'a> From<&'a OwnedResponse> for IncomingResponse<'a> {
fn from(r: &'a OwnedResponse) -> Self {
match r {
@@ -316,6 +325,7 @@ impl<'a> From<&'a OwnedResponse> for IncomingResponse<'a> {
OwnedResponse::ToDevice(r) => IncomingResponse::ToDevice(r),
OwnedResponse::SignatureUpload(r) => IncomingResponse::SignatureUpload(r),
OwnedResponse::KeysBackup(r) => IncomingResponse::KeysBackup(r),
OwnedResponse::RoomMessage(r) => IncomingResponse::RoomMessage(r),
}
}
}