Remove outbound typing listeners
Since KakaoTalk doesn't support typing notifications
This commit is contained in:
parent
60b115bd38
commit
01a89508f6
|
@ -15,29 +15,23 @@
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Union
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from mautrix.bridge import BaseMatrixHandler
|
from mautrix.bridge import BaseMatrixHandler
|
||||||
from mautrix.errors import MatrixError
|
|
||||||
from mautrix.types import (
|
from mautrix.types import (
|
||||||
Event,
|
Event,
|
||||||
EventID,
|
EventID,
|
||||||
EventType,
|
EventType,
|
||||||
MessageType,
|
|
||||||
PresenceEvent,
|
|
||||||
ReactionEvent,
|
ReactionEvent,
|
||||||
ReactionEventContent,
|
ReactionEventContent,
|
||||||
ReceiptEvent,
|
|
||||||
RedactionEvent,
|
RedactionEvent,
|
||||||
RelationType,
|
RelationType,
|
||||||
RoomID,
|
RoomID,
|
||||||
SingleReceiptEventContent,
|
SingleReceiptEventContent,
|
||||||
TextMessageEventContent,
|
|
||||||
TypingEvent,
|
|
||||||
UserID,
|
UserID,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import portal as po, puppet as pu, user as u
|
from . import portal as po, user as u
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .__main__ import KakaoTalkBridge
|
from .__main__ import KakaoTalkBridge
|
||||||
|
@ -147,14 +141,6 @@ class MatrixHandler(BaseMatrixHandler):
|
||||||
user, event_id, content.relates_to.event_id, content.relates_to.key
|
user, event_id, content.relates_to.event_id, content.relates_to.key
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
async def handle_typing(room_id: RoomID, typing: list[UserID]) -> None:
|
|
||||||
portal = await po.Portal.get_by_mxid(room_id)
|
|
||||||
if not portal or not portal.is_direct:
|
|
||||||
return
|
|
||||||
|
|
||||||
await portal.handle_matrix_typing(set(typing))
|
|
||||||
|
|
||||||
async def handle_read_receipt(
|
async def handle_read_receipt(
|
||||||
self,
|
self,
|
||||||
user: u.User,
|
user: u.User,
|
||||||
|
@ -176,14 +162,6 @@ class MatrixHandler(BaseMatrixHandler):
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def handle_ephemeral_event(
|
|
||||||
self, evt: Union[ReceiptEvent, PresenceEvent, TypingEvent]
|
|
||||||
) -> None:
|
|
||||||
if evt.type == EventType.TYPING:
|
|
||||||
await self.handle_typing(evt.room_id, evt.content.user_ids)
|
|
||||||
elif evt.type == EventType.RECEIPT:
|
|
||||||
await self.handle_receipt(evt)
|
|
||||||
|
|
||||||
async def handle_event(self, evt: Event) -> None:
|
async def handle_event(self, evt: Event) -> None:
|
||||||
if evt.type == EventType.ROOM_REDACTION:
|
if evt.type == EventType.ROOM_REDACTION:
|
||||||
evt: RedactionEvent
|
evt: RedactionEvent
|
||||||
|
|
|
@ -127,7 +127,6 @@ class Portal(DBPortal, BasePortal):
|
||||||
_create_room_lock: asyncio.Lock
|
_create_room_lock: asyncio.Lock
|
||||||
_send_locks: dict[int, asyncio.Lock]
|
_send_locks: dict[int, asyncio.Lock]
|
||||||
_noop_lock: FakeLock = FakeLock()
|
_noop_lock: FakeLock = FakeLock()
|
||||||
_typing: set[UserID]
|
|
||||||
backfill_lock: SimpleLock
|
backfill_lock: SimpleLock
|
||||||
_backfill_leave: set[IntentAPI] | None
|
_backfill_leave: set[IntentAPI] | None
|
||||||
_sleeping_to_resync: bool
|
_sleeping_to_resync: bool
|
||||||
|
@ -167,7 +166,6 @@ class Portal(DBPortal, BasePortal):
|
||||||
self._kt_sender = None
|
self._kt_sender = None
|
||||||
self._create_room_lock = asyncio.Lock()
|
self._create_room_lock = asyncio.Lock()
|
||||||
self._send_locks = {}
|
self._send_locks = {}
|
||||||
self._typing = set()
|
|
||||||
self._sleeping_to_resync = False
|
self._sleeping_to_resync = False
|
||||||
self._scheduled_resync = None
|
self._scheduled_resync = None
|
||||||
self._resync_targets = {}
|
self._resync_targets = {}
|
||||||
|
@ -916,16 +914,6 @@ class Portal(DBPortal, BasePortal):
|
||||||
else:
|
else:
|
||||||
self.log.debug(f"{user.mxid} left portal to {self.ktid}")
|
self.log.debug(f"{user.mxid} left portal to {self.ktid}")
|
||||||
|
|
||||||
async def _set_typing(self, users: set[UserID], typing: bool) -> None:
|
|
||||||
self.log.info("TODO: _set_typing")
|
|
||||||
|
|
||||||
async def handle_matrix_typing(self, users: set[UserID]) -> None:
|
|
||||||
await asyncio.gather(
|
|
||||||
self._set_typing(users - self._typing, typing=True),
|
|
||||||
self._set_typing(self._typing - users, typing=False),
|
|
||||||
)
|
|
||||||
self._typing = users
|
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
# region KakaoTalk event handling
|
# region KakaoTalk event handling
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue