diff --git a/mautrix_telegram/matrix.py b/mautrix_telegram/matrix.py index 062cbe00..b9916536 100644 --- a/mautrix_telegram/matrix.py +++ b/mautrix_telegram/matrix.py @@ -94,9 +94,7 @@ class MatrixHandler(BaseMatrixHandler): except MatrixError: pass portal.mxid = room_id - e2be_ok = None - if self.config["bridge.encryption.default"] and self.e2ee: - e2be_ok = await portal.enable_dm_encryption() + e2be_ok = await portal.check_dm_encryption() await portal.save() await inviter.register_portal(portal) if e2be_ok is True: diff --git a/mautrix_telegram/portal/base.py b/mautrix_telegram/portal/base.py index d8233e4a..223317ee 100644 --- a/mautrix_telegram/portal/base.py +++ b/mautrix_telegram/portal/base.py @@ -181,6 +181,10 @@ class BasePortal(MautrixBasePortal, ABC): elif self.peer_type == "channel": return PeerChannel(channel_id=self.tgid) + @property + def is_direct(self) -> bool: + return self.peer_type == "user" + @property def has_bot(self) -> bool: return (bool(self.bot) diff --git a/requirements.txt b/requirements.txt index adea298c..cf063cda 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,6 @@ python-magic>=0.4,<0.5 commonmark>=0.8,<0.10 aiohttp>=3,<4 yarl>=1,<2 -mautrix>=0.8.3,<0.9 +mautrix>=0.8.4,<0.9 telethon>=1.17,<1.18 telethon-session-sqlalchemy>=0.2.14,<0.3