mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-10 00:48:44 -04:00
refactor(widget): Remove 'Matrix' from some identifiers
Just making these a bit less verbose and more consistent with surrounding identifiers.
This commit is contained in:
@@ -55,7 +55,7 @@ pub(crate) enum MatrixDriverRequestData {
|
||||
ReadStateEvent(ReadStateEventRequest),
|
||||
|
||||
/// Send Matrix event that corresponds to the given description.
|
||||
SendMatrixEvent(SendEventRequest),
|
||||
SendEvent(SendEventRequest),
|
||||
|
||||
/// Send a to-device message over the Matrix homeserver.
|
||||
SendToDeviceEvent(SendToDeviceRequest),
|
||||
@@ -196,7 +196,7 @@ impl MatrixDriverRequest for ReadMessageLikeEventRequest {
|
||||
impl FromMatrixDriverResponse for Vec<Raw<AnyTimelineEvent>> {
|
||||
fn from_response(ev: MatrixDriverResponse) -> Option<Self> {
|
||||
match ev {
|
||||
MatrixDriverResponse::MatrixEventRead(response) => Some(response),
|
||||
MatrixDriverResponse::EventsRead(response) => Some(response),
|
||||
_ => {
|
||||
error!("bug in MatrixDriver, received wrong event response");
|
||||
None
|
||||
@@ -251,7 +251,7 @@ pub(crate) struct SendEventRequest {
|
||||
|
||||
impl From<SendEventRequest> for MatrixDriverRequestData {
|
||||
fn from(value: SendEventRequest) -> Self {
|
||||
MatrixDriverRequestData::SendMatrixEvent(value)
|
||||
MatrixDriverRequestData::SendEvent(value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ impl MatrixDriverRequest for SendEventRequest {
|
||||
impl FromMatrixDriverResponse for SendEventResponse {
|
||||
fn from_response(ev: MatrixDriverResponse) -> Option<Self> {
|
||||
match ev {
|
||||
MatrixDriverResponse::MatrixEventSent(response) => Some(response),
|
||||
MatrixDriverResponse::EventSent(response) => Some(response),
|
||||
_ => {
|
||||
error!("bug in MatrixDriver, received wrong event response");
|
||||
None
|
||||
@@ -303,7 +303,7 @@ impl TryInto<send_event_to_device::v3::Response> for MatrixDriverResponse {
|
||||
|
||||
fn try_into(self) -> Result<send_event_to_device::v3::Response, Self::Error> {
|
||||
match self {
|
||||
MatrixDriverResponse::MatrixToDeviceSent(response) => Ok(response),
|
||||
MatrixDriverResponse::ToDeviceSent(response) => Ok(response),
|
||||
_ => Err(de::Error::custom("bug in MatrixDriver, received wrong event response")),
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ impl MatrixDriverRequest for UpdateDelayedEventRequest {
|
||||
impl FromMatrixDriverResponse for update_delayed_event::unstable::Response {
|
||||
fn from_response(ev: MatrixDriverResponse) -> Option<Self> {
|
||||
match ev {
|
||||
MatrixDriverResponse::MatrixDelayedEventUpdate(response) => Some(response),
|
||||
MatrixDriverResponse::DelayedEventUpdated(response) => Some(response),
|
||||
_ => {
|
||||
error!("bug in MatrixDriver, received wrong event response");
|
||||
None
|
||||
|
||||
@@ -64,13 +64,16 @@ pub(crate) enum MatrixDriverResponse {
|
||||
/// A response to an `Action::GetOpenId` command.
|
||||
OpenIdReceived(request_openid_token::v3::Response),
|
||||
/// Client read some Matrix event(s).
|
||||
/// A response to an `Action::ReadMatrixEvent` commands.
|
||||
MatrixEventRead(Vec<Raw<AnyTimelineEvent>>),
|
||||
/// A response to a `Action::ReadEvent` command.
|
||||
EventsRead(Vec<Raw<AnyTimelineEvent>>),
|
||||
/// Client sent some Matrix event. The response contains the event ID.
|
||||
/// A response to an `Action::SendMatrixEvent` command.
|
||||
MatrixEventSent(SendEventResponse),
|
||||
MatrixToDeviceSent(send_event_to_device::v3::Response),
|
||||
MatrixDelayedEventUpdate(delayed_events::update_delayed_event::unstable::Response),
|
||||
/// A response to a `Action::SendEvent` command.
|
||||
EventSent(SendEventResponse),
|
||||
/// A response to a `Action::SendToDevice` command.
|
||||
ToDeviceSent(send_event_to_device::v3::Response),
|
||||
/// Client updated a delayed event.
|
||||
/// A response to a `Action::UpdateDelayedEvent` command.
|
||||
DelayedEventUpdated(delayed_events::update_delayed_event::unstable::Response),
|
||||
}
|
||||
|
||||
pub(super) struct IncomingWidgetMessage {
|
||||
|
||||
@@ -215,14 +215,14 @@ impl WidgetDriver {
|
||||
MatrixDriverRequestData::ReadMessageLikeEvent(cmd) => matrix_driver
|
||||
.read_message_like_events(cmd.event_type.into(), cmd.limit)
|
||||
.await
|
||||
.map(MatrixDriverResponse::MatrixEventRead),
|
||||
.map(MatrixDriverResponse::EventsRead),
|
||||
|
||||
MatrixDriverRequestData::ReadStateEvent(cmd) => matrix_driver
|
||||
.read_state_events(cmd.event_type.into(), &cmd.state_key)
|
||||
.await
|
||||
.map(MatrixDriverResponse::MatrixEventRead),
|
||||
.map(MatrixDriverResponse::EventsRead),
|
||||
|
||||
MatrixDriverRequestData::SendMatrixEvent(req) => {
|
||||
MatrixDriverRequestData::SendEvent(req) => {
|
||||
let SendEventRequest { event_type, state_key, content, delay } = req;
|
||||
// The widget api action does not use the unstable prefix:
|
||||
// `org.matrix.msc4140.delay` so we
|
||||
@@ -234,13 +234,13 @@ impl WidgetDriver {
|
||||
matrix_driver
|
||||
.send(event_type.into(), state_key, content, delay_event_parameter)
|
||||
.await
|
||||
.map(MatrixDriverResponse::MatrixEventSent)
|
||||
.map(MatrixDriverResponse::EventSent)
|
||||
}
|
||||
|
||||
MatrixDriverRequestData::UpdateDelayedEvent(req) => matrix_driver
|
||||
.update_delayed_event(req.delay_id, req.action)
|
||||
.await
|
||||
.map(MatrixDriverResponse::MatrixDelayedEventUpdate),
|
||||
.map(MatrixDriverResponse::DelayedEventUpdated),
|
||||
|
||||
MatrixDriverRequestData::SendToDeviceEvent(send_to_device_request) => {
|
||||
matrix_driver
|
||||
@@ -250,7 +250,7 @@ impl WidgetDriver {
|
||||
send_to_device_request.messages,
|
||||
)
|
||||
.await
|
||||
.map(MatrixDriverResponse::MatrixToDeviceSent)
|
||||
.map(MatrixDriverResponse::ToDeviceSent)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user