@@ -521,12 +521,13 @@ async def _send_crypto_status_error(
521521
522522 if wait_for :
523523 msg += f". The bridge will retry for { wait_for } seconds"
524+ full_msg = f"\u26a0 \ufe0f Your message was not bridged: { msg } ."
525+ if msg == "encryption is not supported" :
526+ full_msg = "🔒️ This bridge has not been configured to support encryption"
524527 event_id = None
525528 if self .config .get ("bridge.delivery_error_reports" , True ):
526529 try :
527- content = TextMessageEventContent (
528- msgtype = MessageType .NOTICE , body = f"\u26a0 Your message was not bridged: { msg } ."
529- )
530+ content = TextMessageEventContent (msgtype = MessageType .NOTICE , body = full_msg )
530531 if edit :
531532 content .set_edit (edit )
532533 event_id = await self .az .intent .send_message (evt .room_id , content )
@@ -752,9 +753,12 @@ async def _post_decrypt(
752753
753754 async def handle_encrypted (self , evt : EncryptedEvent ) -> None :
754755 if not self .e2ee :
756+ self .log .debug (
757+ "Got encrypted message %s from %s, but encryption is not enabled" ,
758+ evt .event_id ,
759+ evt .sender ,
760+ )
755761 await self ._send_crypto_status_error (evt , "encryption is not supported" )
756- # TODO replace this with code in _send_crypto_status_error?
757- await self .handle_encrypted_unsupported (evt )
758762 return
759763 try :
760764 decrypted = await self .e2ee .decrypt (evt , wait_session_timeout = 3 )
@@ -767,16 +771,6 @@ async def handle_encrypted(self, evt: EncryptedEvent) -> None:
767771 else :
768772 await self ._post_decrypt (decrypted )
769773
770- async def handle_encrypted_unsupported (self , evt : EncryptedEvent ) -> None :
771- self .log .debug (
772- "Got encrypted message %s from %s, but encryption is not enabled" ,
773- evt .event_id ,
774- evt .sender ,
775- )
776- await self .az .intent .send_notice (
777- evt .room_id , "🔒️ This bridge has not been configured to support encryption"
778- )
779-
780774 async def _handle_encrypted_wait (
781775 self , evt : EncryptedEvent , err : SessionNotFound , wait : int
782776 ) -> None :
0 commit comments