Skip to content

Commit

Permalink
fix(ffi): Add requested improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasrichardrichter committed Dec 9, 2024
1 parent c769e22 commit 4e3a888
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions bindings/matrix-sdk-ffi/src/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,17 @@ impl Room {
///
/// * `event_type` - The type of the event to send.
///
/// * `content` - The content of the event to send as JSON string.
pub async fn send_custom_event(
/// * `content` - The content of the event to send encoded as JSON string.
pub async fn send_raw(
&self,
event_type: String,
content: String,
) -> Result<(), ClientError> {
let content_json: serde_json::Value = match serde_json::from_str(&content) {
Ok(json) => json,
Err(e) => {
return Err(ClientError::Generic { msg: format!("Failed to parse JSON: {}", e) })
}
};
let content_json: serde_json::Value = serde_json::from_str(&content)
.map_err(|e| ClientError::Generic { msg: format!("Failed to parse JSON: {e}") })?;

self.inner.send_raw(&event_type, content_json).await?;

Ok(())
}

Expand Down

0 comments on commit 4e3a888

Please sign in to comment.