summaryrefslogtreecommitdiff
path: root/src/api/server_server.rs
diff options
context:
space:
mode:
authorTimo Kösters <timo@koesters.xyz>2022-10-09 17:25:06 +0200
committerNyaaori <+@nyaaori.cat>2022-10-10 14:02:04 +0200
commit6b131202b9c2ec36043d73ffd2d787093e4b9fed (patch)
tree4c4229de7dfeeb2a27d15cf5a2c6eac5bea233e8 /src/api/server_server.rs
parent275c6b447d9a3a2bbdc579de77317f9b27d289fe (diff)
downloadconduit-6b131202b9c2ec36043d73ffd2d787093e4b9fed.zip
Bump ruma
Diffstat (limited to 'src/api/server_server.rs')
-rw-r--r--src/api/server_server.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/api/server_server.rs b/src/api/server_server.rs
index d54e130..a8ae272 100644
--- a/src/api/server_server.rs
+++ b/src/api/server_server.rs
@@ -33,18 +33,17 @@ use ruma::{
},
directory::{IncomingFilter, IncomingRoomNetwork},
events::{
- receipt::{ReceiptEvent, ReceiptEventContent},
+ receipt::{ReceiptEvent, ReceiptEventContent, ReceiptType},
room::{
join_rules::{JoinRule, RoomJoinRulesEventContent},
member::{MembershipState, RoomMemberEventContent},
},
RoomEventType, StateEventType,
},
- receipt::ReceiptType,
serde::{Base64, JsonObject, Raw},
- signatures::CanonicalJsonValue,
to_device::DeviceIdOrAllDevices,
- EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId,
+ CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId,
+ OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, RoomId, ServerName, ServerSigningKeyId,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use std::{
@@ -280,7 +279,7 @@ where
.write()
.unwrap()
.insert(
- Box::<ServerName>::from(destination),
+ OwnedServerName::from(destination),
(actual_destination, host),
);
}
@@ -528,7 +527,7 @@ pub async fn get_server_keys_route() -> Result<impl IntoResponse> {
return Err(Error::bad_config("Federation is disabled."));
}
- let mut verify_keys: BTreeMap<Box<ServerSigningKeyId>, VerifyKey> = BTreeMap::new();
+ let mut verify_keys: BTreeMap<OwnedServerSigningKeyId, VerifyKey> = BTreeMap::new();
verify_keys.insert(
format!("ed25519:{}", services().globals.keypair().version())
.try_into()
@@ -669,7 +668,7 @@ pub async fn send_transaction_message_route(
};
// 0. Check the server is in the room
- let room_id = match value
+ let room_id: OwnedRoomId = match value
.get("room_id")
.and_then(|id| RoomId::parse(id.as_str()?).ok())
{
@@ -1007,7 +1006,7 @@ pub async fn get_missing_events_route(
continue;
}
queued_events.extend_from_slice(
- &serde_json::from_value::<Vec<Box<EventId>>>(
+ &serde_json::from_value::<Vec<OwnedEventId>>(
serde_json::to_value(pdu.get("prev_events").cloned().ok_or_else(|| {
Error::bad_database("Event in db has no prev_events field.")
})?)
@@ -1411,7 +1410,7 @@ async fn create_join_event(
}
};
- let origin: Box<ServerName> = serde_json::from_value(
+ let origin: OwnedServerName = serde_json::from_value(
serde_json::to_value(value.get("origin").ok_or(Error::BadRequest(
ErrorKind::InvalidParam,
"Event needs an origin field.",
@@ -1474,6 +1473,7 @@ async fn create_join_event(
.filter_map(|(_, id)| services().rooms.timeline.get_pdu_json(id).ok().flatten())
.map(PduEvent::convert_to_outgoing_federation_event)
.collect(),
+ origin: services().globals.server_name().to_string(),
})
}
@@ -1564,10 +1564,10 @@ pub async fn create_invite_route(
// Add event_id back
signed_event.insert(
"event_id".to_owned(),
- CanonicalJsonValue::String(event_id.into()),
+ CanonicalJsonValue::String(event_id.to_string()),
);
- let sender: Box<_> = serde_json::from_value(
+ let sender: OwnedUserId = serde_json::from_value(
signed_event
.get("sender")
.ok_or(Error::BadRequest(