Add option to update m.direct with double puppeting

This commit is contained in:
Tulir Asokan
2020-08-21 21:20:49 +03:00
parent 292745866d
commit 66917b6db0
7 changed files with 33 additions and 6 deletions
+4
View File
@@ -49,6 +49,10 @@ class Portal(Base):
def get_by_tgid(cls, tgid: TelegramID, tg_receiver: TelegramID) -> Optional['Portal']:
return cls._select_one_or_none(cls.c.tgid == tgid, cls.c.tg_receiver == tg_receiver)
@classmethod
def find_private_chats(cls, tg_receiver: TelegramID) -> Iterable['Portal']:
yield from cls._select_all(cls.c.tg_receiver == tg_receiver, cls.c.peer_type == "user")
@classmethod
def get_by_mxid(cls, mxid: RoomID) -> Optional['Portal']:
return cls._select_one_or_none(cls.c.mxid == mxid)