@@ -1328,10 +1328,16 @@ impl OlmMachine {
1328
1328
self . inner . verification_machine . get_requests ( user_id)
1329
1329
}
1330
1330
1331
+ /// Given a to-device event that has either been decrypted or arrived in
1332
+ /// plaintext, handle it.
1333
+ ///
1334
+ /// Here, we only process events that are allowed to arrive in plaintext.
1331
1335
async fn handle_to_device_event ( & self , changes : & mut Changes , event : & ToDeviceEvents ) {
1332
1336
use crate :: types:: events:: ToDeviceEvents :: * ;
1333
1337
1334
1338
match event {
1339
+ // These are handled here because we accept them either plaintext or
1340
+ // encrypted
1335
1341
RoomKeyRequest ( e) => self . inner . key_request_machine . receive_incoming_key_request ( e) ,
1336
1342
SecretRequest ( e) => self . inner . key_request_machine . receive_incoming_secret_request ( e) ,
1337
1343
RoomKeyWithheld ( e) => self . add_withheld_info ( changes, e) ,
@@ -1345,8 +1351,16 @@ impl OlmMachine {
1345
1351
| KeyVerificationStart ( ..) => {
1346
1352
self . handle_verification_event ( event) . await ;
1347
1353
}
1348
- Dummy ( _) | RoomKey ( _) | ForwardedRoomKey ( _) | RoomEncrypted ( _) => { }
1349
- _ => { }
1354
+
1355
+ // We don't process custom or dummy events at all
1356
+ Custom ( _) | Dummy ( _) => { }
1357
+
1358
+ // Encrypted events are handled elsewhere
1359
+ RoomEncrypted ( _) => { }
1360
+
1361
+ // These are handled in `handle_decrypted_to_device_event` because we
1362
+ // only accept them if they arrive encrypted.
1363
+ SecretSend ( _) | RoomKey ( _) | ForwardedRoomKey ( _) => { }
1350
1364
}
1351
1365
}
1352
1366
0 commit comments