mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-01-14 21:46:29 +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) => {
|
Edu::Receipt(receipt) => {
|
||||||
for (room_id, room_updates) in receipt.receipts {
|
for (room_id, room_updates) in receipt.receipts {
|
||||||
for (user_id, user_updates) in room_updates.read {
|
for (user_id, user_updates) in room_updates.read {
|
||||||
|
if user_id.server_name() == sender_servername {
|
||||||
if let Some((event_id, _)) = user_updates
|
if let Some((event_id, _)) = user_updates
|
||||||
.event_ids
|
.event_ids
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -821,8 +822,10 @@ pub async fn send_transaction_message_route(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Edu::Typing(typing) => {
|
Edu::Typing(typing) => {
|
||||||
if services()
|
if typing.user_id.server_name() == sender_servername
|
||||||
|
&& services()
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.is_joined(&typing.user_id, &typing.room_id)?
|
.is_joined(&typing.user_id, &typing.room_id)?
|
||||||
|
@ -849,23 +852,23 @@ pub async fn send_transaction_message_route(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Edu::DeviceListUpdate(DeviceListUpdateContent { user_id, .. }) => {
|
Edu::DeviceListUpdate(DeviceListUpdateContent { user_id, .. }) => {
|
||||||
|
if user_id.server_name() == sender_servername {
|
||||||
services().users.mark_device_key_update(&user_id)?;
|
services().users.mark_device_key_update(&user_id)?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Edu::DirectToDevice(DirectDeviceContent {
|
Edu::DirectToDevice(DirectDeviceContent {
|
||||||
sender,
|
sender,
|
||||||
ev_type,
|
ev_type,
|
||||||
message_id,
|
message_id,
|
||||||
messages,
|
messages,
|
||||||
}) => {
|
}) => {
|
||||||
|
if sender.server_name() == sender_servername
|
||||||
// Check if this is a new transaction id
|
// Check if this is a new transaction id
|
||||||
if services()
|
&& services()
|
||||||
.transaction_ids
|
.transaction_ids
|
||||||
.existing_txnid(&sender, None, &message_id)?
|
.existing_txnid(&sender, None, &message_id)?
|
||||||
.is_some()
|
.is_none()
|
||||||
{
|
{
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (target_user_id, map) in &messages {
|
for (target_user_id, map) in &messages {
|
||||||
for (target_device_id_maybe, event) in map {
|
for (target_device_id_maybe, event) in map {
|
||||||
match target_device_id_maybe {
|
match target_device_id_maybe {
|
||||||
|
@ -912,14 +915,13 @@ pub async fn send_transaction_message_route(
|
||||||
.transaction_ids
|
.transaction_ids
|
||||||
.add_txnid(&sender, None, &message_id, &[])?;
|
.add_txnid(&sender, None, &message_id, &[])?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Edu::SigningKeyUpdate(SigningKeyUpdateContent {
|
Edu::SigningKeyUpdate(SigningKeyUpdateContent {
|
||||||
user_id,
|
user_id,
|
||||||
master_key,
|
master_key,
|
||||||
self_signing_key,
|
self_signing_key,
|
||||||
}) => {
|
}) => {
|
||||||
if user_id.server_name() != sender_servername {
|
if user_id.server_name() == sender_servername {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if let Some(master_key) = master_key {
|
if let Some(master_key) = master_key {
|
||||||
services().users.add_cross_signing_keys(
|
services().users.add_cross_signing_keys(
|
||||||
&user_id,
|
&user_id,
|
||||||
|
@ -930,6 +932,7 @@ pub async fn send_transaction_message_route(
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Edu::_Custom(_) => {}
|
Edu::_Custom(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue