mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 13:03:47 +03:00
fix: userid checks for incoming EDUs
This commit is contained in:
parent
dd19877528
commit
48c1f3bdba
1 changed files with 91 additions and 88 deletions
|
@ -782,6 +782,7 @@ pub async fn send_transaction_message_route(
|
|||
Edu::Receipt(receipt) => {
|
||||
for (room_id, room_updates) in receipt.receipts {
|
||||
for (user_id, user_updates) in room_updates.read {
|
||||
if user_id.server_name() == sender_servername {
|
||||
if let Some((event_id, _)) = user_updates
|
||||
.event_ids
|
||||
.iter()
|
||||
|
@ -821,8 +822,10 @@ pub async fn send_transaction_message_route(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Edu::Typing(typing) => {
|
||||
if services()
|
||||
if typing.user_id.server_name() == sender_servername
|
||||
&& services()
|
||||
.rooms
|
||||
.state_cache
|
||||
.is_joined(&typing.user_id, &typing.room_id)?
|
||||
|
@ -849,23 +852,23 @@ pub async fn send_transaction_message_route(
|
|||
}
|
||||
}
|
||||
Edu::DeviceListUpdate(DeviceListUpdateContent { user_id, .. }) => {
|
||||
if user_id.server_name() == sender_servername {
|
||||
services().users.mark_device_key_update(&user_id)?;
|
||||
}
|
||||
}
|
||||
Edu::DirectToDevice(DirectDeviceContent {
|
||||
sender,
|
||||
ev_type,
|
||||
message_id,
|
||||
messages,
|
||||
}) => {
|
||||
if sender.server_name() == sender_servername
|
||||
// Check if this is a new transaction id
|
||||
if services()
|
||||
&& services()
|
||||
.transaction_ids
|
||||
.existing_txnid(&sender, None, &message_id)?
|
||||
.is_some()
|
||||
.is_none()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (target_user_id, map) in &messages {
|
||||
for (target_device_id_maybe, event) in map {
|
||||
match target_device_id_maybe {
|
||||
|
@ -912,14 +915,13 @@ pub async fn send_transaction_message_route(
|
|||
.transaction_ids
|
||||
.add_txnid(&sender, None, &message_id, &[])?;
|
||||
}
|
||||
}
|
||||
Edu::SigningKeyUpdate(SigningKeyUpdateContent {
|
||||
user_id,
|
||||
master_key,
|
||||
self_signing_key,
|
||||
}) => {
|
||||
if user_id.server_name() != sender_servername {
|
||||
continue;
|
||||
}
|
||||
if user_id.server_name() == sender_servername {
|
||||
if let Some(master_key) = master_key {
|
||||
services().users.add_cross_signing_keys(
|
||||
&user_id,
|
||||
|
@ -930,6 +932,7 @@ pub async fn send_transaction_message_route(
|
|||
)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Edu::_Custom(_) => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue