update ruma
This commit is contained in:
parent
f3795846b5
commit
e9f87e1952
42 changed files with 514 additions and 500 deletions
|
@ -6,7 +6,7 @@ use crate::{
|
|||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
r0::state::{get_state_events, get_state_events_for_key, send_state_event},
|
||||
state::{get_state_events, get_state_events_for_key, send_state_event},
|
||||
},
|
||||
events::{
|
||||
room::{
|
||||
|
@ -28,8 +28,8 @@ use ruma::{
|
|||
/// - If event is new canonical_alias: Rejects if alias is incorrect
|
||||
pub async fn send_state_event_for_key_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<send_state_event::Request<'_>>,
|
||||
) -> Result<send_state_event::Response> {
|
||||
body: Ruma<send_state_event::v3::Request<'_>>,
|
||||
) -> Result<send_state_event::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
let event_id = send_state_event_for_key_helper(
|
||||
|
@ -45,7 +45,7 @@ pub async fn send_state_event_for_key_route(
|
|||
db.flush()?;
|
||||
|
||||
let event_id = (*event_id).to_owned();
|
||||
Ok(send_state_event::Response { event_id })
|
||||
Ok(send_state_event::v3::Response { event_id })
|
||||
}
|
||||
|
||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}`
|
||||
|
@ -57,8 +57,8 @@ pub async fn send_state_event_for_key_route(
|
|||
/// - If event is new canonical_alias: Rejects if alias is incorrect
|
||||
pub async fn send_state_event_for_empty_key_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<send_state_event::Request<'_>>,
|
||||
) -> Result<RumaResponse<send_state_event::Response>> {
|
||||
body: Ruma<send_state_event::v3::Request<'_>>,
|
||||
) -> Result<RumaResponse<send_state_event::v3::Response>> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
// Forbid m.room.encryption if encryption is disabled
|
||||
|
@ -82,7 +82,7 @@ pub async fn send_state_event_for_empty_key_route(
|
|||
db.flush()?;
|
||||
|
||||
let event_id = (*event_id).to_owned();
|
||||
Ok(send_state_event::Response { event_id }.into())
|
||||
Ok(send_state_event::v3::Response { event_id }.into())
|
||||
}
|
||||
|
||||
/// # `GET /_matrix/client/r0/rooms/{roomid}/state`
|
||||
|
@ -92,8 +92,8 @@ pub async fn send_state_event_for_empty_key_route(
|
|||
/// - If not joined: Only works if current room history visibility is world readable
|
||||
pub async fn get_state_events_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<get_state_events::Request<'_>>,
|
||||
) -> Result<get_state_events::Response> {
|
||||
body: Ruma<get_state_events::v3::Request<'_>>,
|
||||
) -> Result<get_state_events::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
#[allow(clippy::blocks_in_if_conditions)]
|
||||
|
@ -121,7 +121,7 @@ pub async fn get_state_events_route(
|
|||
));
|
||||
}
|
||||
|
||||
Ok(get_state_events::Response {
|
||||
Ok(get_state_events::v3::Response {
|
||||
room_state: db
|
||||
.rooms
|
||||
.room_state_full(&body.room_id)?
|
||||
|
@ -138,8 +138,8 @@ pub async fn get_state_events_route(
|
|||
/// - If not joined: Only works if current room history visibility is world readable
|
||||
pub async fn get_state_events_for_key_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<get_state_events_for_key::Request<'_>>,
|
||||
) -> Result<get_state_events_for_key::Response> {
|
||||
body: Ruma<get_state_events_for_key::v3::Request<'_>>,
|
||||
) -> Result<get_state_events_for_key::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
#[allow(clippy::blocks_in_if_conditions)]
|
||||
|
@ -175,7 +175,7 @@ pub async fn get_state_events_for_key_route(
|
|||
"State event not found.",
|
||||
))?;
|
||||
|
||||
Ok(get_state_events_for_key::Response {
|
||||
Ok(get_state_events_for_key::v3::Response {
|
||||
content: serde_json::from_str(event.content.get())
|
||||
.map_err(|_| Error::bad_database("Invalid event content in database"))?,
|
||||
})
|
||||
|
@ -188,8 +188,8 @@ pub async fn get_state_events_for_key_route(
|
|||
/// - If not joined: Only works if current room history visibility is world readable
|
||||
pub async fn get_state_events_for_empty_key_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<get_state_events_for_key::Request<'_>>,
|
||||
) -> Result<RumaResponse<get_state_events_for_key::Response>> {
|
||||
body: Ruma<get_state_events_for_key::v3::Request<'_>>,
|
||||
) -> Result<RumaResponse<get_state_events_for_key::v3::Response>> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
#[allow(clippy::blocks_in_if_conditions)]
|
||||
|
@ -225,7 +225,7 @@ pub async fn get_state_events_for_empty_key_route(
|
|||
"State event not found.",
|
||||
))?;
|
||||
|
||||
Ok(get_state_events_for_key::Response {
|
||||
Ok(get_state_events_for_key::v3::Response {
|
||||
content: serde_json::from_str(event.content.get())
|
||||
.map_err(|_| Error::bad_database("Invalid event content in database"))?,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue